473,385 Members | 1,357 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,385 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 14034
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.