Link to home
Start Free TrialLog in
Avatar of zintech
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:MyConnectionString2 %>"
       
        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
Avatar of ralmada
ralmada
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also take a look at this link

http://forums.asp.net/t/1156889.aspx/1