469,609 Members | 1,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Parameter count does not match Parameter Value count."

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,n ew string[] {"Account"},arParams);

return dsAccount;

}

catch (SqlException ex)

{

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

return null;

}

Thanks

laszlo

Jul 21 '05 #1
4 13562
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)


"Laszlo Csabi" <lc@ynotcallme.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
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,n ew string[] {"Account"},arParams);

return dsAccount;

}

catch (SqlException ex)

{

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

return null;

}

Thanks

laszlo

Jul 21 '05 #2
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.
--
Happy coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #3
The procedure only defines
@FKCustomerID int,

@Assigned bit

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

"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:op.spiwuab0klbvpo@stone...
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.
--
Happy coding!
Morten Wennevik [C# MVP]

Jul 21 '05 #4
Sorry, ignore that.

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by test | last post: by
1 post views Thread by cameron | last post: by
23 posts views Thread by Gary Wessle | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.