473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 14039
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Furey | last post by:
Hi, I am using the XSLT document to filter records from an XML document The XSL is shown below: I have a parameter named "search-for" that is used to bring back a list of Vendor Names that...
5
by: test | last post by:
why does this code cause the "Parameter count does not match Parameter Value count" error.??? Dim arGetaffManageparms() As System.Data.SqlClient.SqlParameter = New...
3
by: Douwe | last post by:
I try to build my own version of printf which just passes all arguments to the original printf. As long as I keep it with the single argument version everything is fine. But their is also a version...
1
by: cameron | last post by:
I am attempting to pass in an XmlDocument as a parameter to a transform: from my sample ASPX page: string BaseDir = "/cameron/Play/ComplexParam/"; XmlDocument XSL = new XmlDocument();...
4
by: Laszlo Csabi | last post by:
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."
2
by: Zeya | last post by:
I have an application where I am required to run a full text query. My database is MySQL and code in C#. The way all queries are SELECT * FROM table WHERE firstname = ? and using command...
23
by: Gary Wessle | last post by:
Hi I have a vector<charwhich looks like this (a d d d a d s g e d d d d d k) I need to get the biggest count of consecutive 'd'. 5 in this example I am toying with this method but not sure if...
8
by: Alec MacLean | last post by:
Hi, I'm using the DAAB Ent Lib (Jan 2006) for .NET 2.0, with VS 2005 Pro. My project is a Web app project (using the WAP add in). Background: I'm creating a survey system for our company, for...
2
by: ems9tech | last post by:
I can't get this count to return a number without an empty quote at the end ( " ) or getting NaN. Does anyone know why? I've searched and don't see any other postings on this issue. I'm using VS...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.