I have an aspx page, which retrieves data from a table, I have Update, Delete, Cancel buttons. Update works, Cancel works, but Delete does not work, I get error:
Must declare the scalar variable "@UID".
My code looks like this:
<asp:SqlDataSource ID="sdsDetail" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString%>"
DeleteCommand="DELETE FROM [table] WHERE [UID] = @UID"
SelectCommand="SELECT UID, a, b, c FROM [table] WHERE ([UID] = @UID)"
UpdateCommand="UPDATE [table] SET [a] = @a, [b] = @b, [c] = @c WHERE [UID] = @UID">
<SelectParameters>
<asp:QueryStringParameter Name="UID" QueryStringField="UID" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:QueryStringParameter Name="UID" QueryStringField="UID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="a" />
<asp:Parameter Name="b" />
<asp:Parameter Name="c" />
</UpdateParameters>
</asp:SqlDataSource>
Your help is appreciated.