参数值错误 [英] Parameter Value error

查看:77
本文介绍了参数值错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么此代码导致参数计数与参数值不匹配

count错误。???


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.SqlD ataJunction.ExecuteReader(Configuration Settings.AppSettings(gen3。

Global.CfgKeyConnString)," getAffManage",arGetaffManageparms)

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(Configuration Settings.AppSettings(gen3.
Global.CfgKeyConnString), "getAffManage", arGetaffManageparms)

推荐答案

test< te ** @ brainscanstudios.com>写道:
test <te**@brainscanstudios.com> wrote:
为什么这段代码导致参数计数不匹配
参数值计数错误。???
why does this code cause the "Parameter count does not match
Parameter Value count" error.???




它向我建议你的SQL语句包含一个不同的数字

的参数比你的那些配置。这里你的SQL

声明是什么?


-

Jon Skeet - < sk *** @ pobox.com> ;
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


感谢您的回复...

这是我的存储过程


CREATE PROCEDURE getAffManage




@ IDaff2Manage int,

@affItemID int OUTPUT,

@affItemName Varchar(35)输出



AS


SET NOCOUNT ON;

SELECT @ affItemID = affregID,@ affItemName = affItemRefName

FROM affregistrationitems where affid = @ IDaff2Manage;

GO

" Jon Skeet [C#MVP]" < SK *** @ pobox.com>在消息中写道

新闻:MP ************************ @ msnews.microsoft.c om ...
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
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
test< te ** @ brainscanstudios.com>写道:
test <te**@brainscanstudios.com> wrote:
为什么这段代码导致参数计数不匹配
参数值计数错误。???
why does this code cause the "Parameter count does not match
Parameter Value count" error.???



它告诉我你的SQL语句包含的参数数量与你配置的数量不同。这里有什么SQL语句?

- Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet
如果回复小组,请做不要给我发邮件



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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



test< te ** @ brainscanstudios.com>写道:
test <te**@brainscanstudios.com> wrote:
感谢您的回复...
这是我的存储过程
thanks for you response...
here is my stored procedure




您是否将命令类型设置为StoredProcedure?


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复群组,请不要给我发邮件



And are you setting the command type to StoredProcedure?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


这篇关于参数值错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆