Wednesday, March 7, 2012

Error--Procedure SP_Insert_NewPipeLine expects parameter @CompanyId, which was not supplie

Can any body help me in solving this problem.

First I use to get Error which reads "Object Must Implement Iconvertible"

After using the overloaded Sp.paramerers.add() function It started giving this problem.

I am giving the sample code.

ConObject =

new SqlConnection(ConString);

ConObject.Open();

string SpString ="dbo.SP_Insert_NewPipeLine";

SqlCommand CmdObject =

new SqlCommand(SpString,ConObject);

CmdObject.CommandType = CommandType.StoredProcedure;

CmdObject.Parameters.Add("@.RequestTypeId",SqlDbType.Int,4,"0");

//CmdObject.Parameters["@.RequestTypeId"].Value= 0;

CmdObject.Parameters.Add("@.OnBehalfOf",SqlDbType.Int,4,"21");

//Onbehalf of Id//CmdObject.Parameters["@.OnBehalfOf"].Value = 21;

CmdObject.Parameters.Add("@.SubmittedBy",SqlDbType.Int,4,ddlSalesRep.SelectedValue.ToString());

//Submitted by Id//CmdObject.Parameters["@.SubmittedBy"].Value = ddlSalesRep.SelectedItem.Value;

CmdObject.Parameters.Add("@.CompanyId",SqlDbType.Int,4,ddlCustomer.SelectedItem.Value.ToString());

//Company_Id//CmdObject.Parameters["@.CompanyId"].Value = ddlCustomer.SelectedItem.Value;

CmdObject.ExecuteScalar();

Execuse me, may be a silly question: are you sure the ddlSalesRep.SelectedValue/ddlCustomer.SelectedItem.Value has value when the command was being executed?

|||

I am sure that all fields have values before submitting the page.

There is no error on data types also.

Finally the error Comes as

"Object can not Implement Iconvertible"

No comments:

Post a Comment