Working on setting up a SqlDataSource connecting MySQL database to a ASP .NET GridView.
The Delete Command is:
DeleteCommand="DELETE FROM troutetracking WHERE id=?id"
The Delete parameter is:
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
When I run a delete link on the Gridview the following error message appears:
MySql.Data.MySqlClient.MySqlException: Parameter ‘?id’ must be defined.
What is the proper syntax?
This blog ran into a similar issue:
link text
What I needed to do was update the connection to string to contain “Allow User Variables=True”.
I did this by using the ‘Advanced’ button when setting up the data source.
The delete query also needed to be tweaked to be: