Adding parameter to sqldatasource, How should i pass them to execute my stored procedure in asp.net
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
you would need to prefix your parameter name with a "@"
your parameters would look like this instead.
<asp:Parameter DefaultValue="" Name="@Domain" Size="16" Type="String" />
<asp:Parameter DefaultValue="" Name="@Description" Type="String" />
<asp:Parameter DefaultValue="4" Name="@OperationType" Type="Byte" />
精彩评论