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
zintechAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ralmadaCommented:
did you set your DataKeyNames property on the gridview control to the column in question?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ralmadaCommented:
also take a look at this link

http://forums.asp.net/t/1156889.aspx/1
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.