A
André
Hi,
I created a button in order to delete all the records at once in a gridview.
But i get the error: No value given for one or more required parameters
Thanks
André
The aspx file contains:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="..."
....
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
....
</asp:GridView>
<input id="Button1" type="submit" runat="server" value="Cancel all" />
The code-behind contains:
Protected Sub Button1_ServerClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
x="this value"
SqlDataSource1.SelectParameters.Add("param1", x)
SqlDataSource1.DeleteCommand = "delete from mytable where field1 = @param1"
SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.Text
SqlDataSource1.Delete()
End Sub
I created a button in order to delete all the records at once in a gridview.
But i get the error: No value given for one or more required parameters
Thanks
André
The aspx file contains:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="..."
....
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
....
</asp:GridView>
<input id="Button1" type="submit" runat="server" value="Cancel all" />
The code-behind contains:
Protected Sub Button1_ServerClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
x="this value"
SqlDataSource1.SelectParameters.Add("param1", x)
SqlDataSource1.DeleteCommand = "delete from mytable where field1 = @param1"
SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.Text
SqlDataSource1.Delete()
End Sub