添加参数到sqldatasource,我应该如何传递它们来执行asp.net中的存储过程
我正在使用 gridview,其中调用有 4 个输入参数的存储过程。
在这 4 个参数中,给出的值应满足
DomainId = 这必须是要删除的行。这是主键
Domain = 该字段必须作为 NULL 传递给 SP。
描述= 该字段必须作为 NULL 传递。
OperationType= 该字段必须由程序员作为一些静态值传递,例如 4
我需要如何在此处指定这些...
问题的更多详细信息是 此处。
请帮帮我。
<DeleteParameters>
<asp:ControlParameter ControlID="GridView1" Name="DomainId"
PropertyName="SelectedValue" Size="4" Type="Int32" />
<asp:Parameter DefaultValue="" Name="Domain" Size="16" Type="String" />
<asp:Parameter DefaultValue="" Name="Description" Type="String" />
<asp:Parameter DefaultValue="4" Name="OperationType" Type="Byte" />
</DeleteParameters>
使用它运行我的代码时,
我收到一个错误
过程或函数 'spOnlineTest_Domain' 期望 参数“@Domain”,这不是 提供
I am using a gridview where i am calling a stored procedure which has 4 input parameters.
Out of these 4 parameters, values are to be given such that
DomainId = This has to be the row which is to be deleted. This is a primary key
Domain = This field has to be passed to SP as NULL.
Description= This field has to be passed as NULL.
OperationType= This field has to be passed by programmer as some static value say 4
How to i need to specify these here...
More details of the Question are
here.
Please help me out.
<DeleteParameters>
<asp:ControlParameter ControlID="GridView1" Name="DomainId"
PropertyName="SelectedValue" Size="4" Type="Int32" />
<asp:Parameter DefaultValue="" Name="Domain" Size="16" Type="String" />
<asp:Parameter DefaultValue="" Name="Description" Type="String" />
<asp:Parameter DefaultValue="4" Name="OperationType" Type="Byte" />
</DeleteParameters>
On running my code using this
I gets an error
Procedure or Function
'spOnlineTest_Domain' expects
parameter '@Domain', which was not
supplied
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在参数名称前加上“@”前缀,
您的参数将如下所示。
you would need to prefix your parameter name with a "@"
your parameters would look like this instead.