Parameter Value error

  • Thread starter Thread starter test
  • Start date Start date
T

test

why does this code cause the "Parameter count does not match Parameter Value
count" error.???



Dim arGetaffManageparms() As System.Data.SqlClient.SqlParameter = New
System.Data.SqlClient.SqlParameter(3) {}

arGetaffManageparms(0) = New
System.Data.SqlClient.SqlParameter("@IDaff2Manage",
System.Data.SqlDbType.Int)

arGetaffManageparms(0).Value = CInt(Request.QueryString("ID2Manage"))

arGetaffManageparms(1) = New
System.Data.SqlClient.SqlParameter("@affItemID", System.Data.SqlDbType.Int)

arGetaffManageparms(1).Direction = System.Data.ParameterDirection.Output

arGetaffManageparms(2) = New
System.Data.SqlClient.SqlParameter("@affItemName",
System.Data.SqlDbType.VarChar, 35)

arGetaffManageparms(2).Direction = System.Data.ParameterDirection.Output

Dim getAffInfoStuff As System.Data.SqlClient.SqlDataReader =
ijsdac.SqlDataJunction.ExecuteReader(ConfigurationSettings.AppSettings(gen3.
Global.CfgKeyConnString), "getAffManage", arGetaffManageparms)
 
test said:
why does this code cause the "Parameter count does not match
Parameter Value count" error.???

It suggests to me that your SQL statement contains a different number
of parameters than the ones you've configured. What is your SQL
statement here?
 
thanks for you response...
here is my stored procedure

CREATE PROCEDURE getAffManage

(
@IDaff2Manage int,
@affItemID int OUTPUT,
@affItemName Varchar(35) OUTPUT
)
AS

SET NOCOUNT ON;
SELECT @affItemID=affregID, @affItemName=affItemRefName
FROM affregistrationitems where affid=@IDaff2Manage;
GO
 
that fixed the issue...THANKS!
I don't know why I forgot that... but thanks!
Now, it is not failing, but no data is coming back... and that doesn't make
any sense.
The only change to my code, since my initial question is the following line.

Dim getAffInfoStuff As System.Data.SqlClient.SqlDataReader =
ijsdac.SqlDataJunction.ExecuteReader(ConfigurationSettings.AppSettings(gen3.
Global.CfgKeyConnString), "getAffManage", arGetaffManageparms)

it is now:
Dim getAffInfoStuff As System.Data.SqlClient.SqlDataReader =
ijsdac.SqlDataJunction.ExecuteReader(ConfigurationSettings.AppSettings(gen3.
Global.CfgKeyConnString), system.data.CommandType.StoredProcedure,
"getAffManage", arGetaffManageparms)

.... nothing is coming out.

tp
 
test said:
that fixed the issue...THANKS!
I don't know why I forgot that... but thanks!
Now, it is not failing, but no data is coming back... and that doesn't make
any sense.
The only change to my code, since my initial question is the following line.

Dim getAffInfoStuff As System.Data.SqlClient.SqlDataReader =
ijsdac.SqlDataJunction.ExecuteReader(ConfigurationSettings.AppSettings(gen3.
Global.CfgKeyConnString), "getAffManage", arGetaffManageparms)

it is now:
Dim getAffInfoStuff As System.Data.SqlClient.SqlDataReader =
ijsdac.SqlDataJunction.ExecuteReader(ConfigurationSettings.AppSettings(gen3.
Global.CfgKeyConnString), system.data.CommandType.StoredProcedure,
"getAffManage", arGetaffManageparms)

... nothing is coming out.

I suggest you look at what's happening on the database with a profiler.
That may give you some hints.
 
Back
Top