zintech
asked on
Delete Command on GridView
I have an SqlDatasource that I am using with a GridView. Everything works fine except for the delete command on the SqlDatasource. I have two parameters on the DELETE command that I simply want it to delete from the table where those two parameters equal what the user selected to delete on the Gridview. Here is the code for the SqlDataSource:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnec tionString 2 %>"
DeleteCommand="DELETE FROM table1 WHERE column1 = @param1 AND column2 = @param2"
<DeleteParameters>
<asp:Parameter Name="param1" />
<asp:Parameter Name="param2" />
</DeleteParameters>
</asp:SqlDataSource>
It gives me an error telling me I need to declare the scalar variable "param2" and I cannot figure out why. I have it declared right there in the code
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnec
DeleteCommand="DELETE FROM table1 WHERE column1 = @param1 AND column2 = @param2"
<DeleteParameters>
<asp:Parameter Name="param1" />
<asp:Parameter Name="param2" />
</DeleteParameters>
</asp:SqlDataSource>
It gives me an error telling me I need to declare the scalar variable "param2" and I cannot figure out why. I have it declared right there in the code
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://forums.asp.net/t/1156889.aspx/1