472,805 Members | 4,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 13975
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.