Parameter count does not match Parameter Value count."

J

JohnFol

The parameter count is probably 3 as there is a default @Return
I would typically use a command object to represent tblAccount_SELECT_BY_PROMOTIONAL and just do the following:

sqlCommand.Parameters.add ("@FKCustomerID",PKCustomerID)
sqlCommand.Parameters.add ("@Assigned",Assigned)




Hi Folks,

Can someone explain me why I'm getting the following error?



The error message I got is : "Parameter count does not match Parameter Value count."



Here is the Stored Procedure:

ALTER PROCEDURE dbo.tblAccount_SELECT_BY_PROMOTIONAL

@FKCustomerID int,

@Assigned bit

AS

SELECT * FROM tblAccount WHERE Assigned = @Assigned AND IsPromotional=1 AND PromotionalOwner = @FKCustomerID AND DELETED=0



Here is the Code where I call from:

try

{

ENTITY.dsAccount dsAccount = new YNOTCALLME.COMMUNICATION.ENTITY.dsAccount();

SqlParameter [] arParams = new SqlParameter [2];

arParams[0] = new SqlParameter("@FKCustomerID",PKCustomerID);

arParams[1] = new SqlParameter("@Assigned",Assigned);

SqlHelper.FillDataset (DBConnection, "tblAccount_SELECT_BY_PROMOTIONAL",dsAccount,new string[] {"Account"},arParams);

return dsAccount;

}

catch (SqlException ex)

{

YNOTCALLME.FRAMEWORK.ERRORMANAGER.Error.Save (ex);

return null;

}



Thanks



laszlo
 
M

Morten Wennevik

Hi John,

I might be wrong in this, but shouldn't you add a Parameter for IsPromotional?
The error messages could indicate so as there are three parameters but only two parameter objects.
 
J

JohnFol

The procedure only defines
@FKCustomerID int,

@Assigned bit



IsPromotional is not defined as a parameter, but should be a field from
tblAccount.
 
L

Laszlo Csabi

Hi Folks,

Can someone explain me why I'm getting the following error?



The error message I got is : "Parameter count does not match Parameter Value count."



Here is the Stored Procedure:

ALTER PROCEDURE dbo.tblAccount_SELECT_BY_PROMOTIONAL

@FKCustomerID int,

@Assigned bit

AS

SELECT * FROM tblAccount WHERE Assigned = @Assigned AND IsPromotional=1 AND PromotionalOwner = @FKCustomerID AND DELETED=0



Here is the Code where I call from:

try

{

ENTITY.dsAccount dsAccount = new YNOTCALLME.COMMUNICATION.ENTITY.dsAccount();

SqlParameter [] arParams = new SqlParameter [2];

arParams[0] = new SqlParameter("@FKCustomerID",PKCustomerID);

arParams[1] = new SqlParameter("@Assigned",Assigned);

SqlHelper.FillDataset (DBConnection, "tblAccount_SELECT_BY_PROMOTIONAL",dsAccount,new string[] {"Account"},arParams);

return dsAccount;

}

catch (SqlException ex)

{

YNOTCALLME.FRAMEWORK.ERRORMANAGER.Error.Save (ex);

return null;

}



Thanks



laszlo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top