<asp:gridview id="gridview1" runat="server" datasourceid="sqldatasource1" autogeneratecolumns="false" onselectedindexchanged="gridview1_selectedindexchanged" onrowcommand="gridview1_rowcommand"> <columns> <asp:templatefield headertext="id"> <itemtemplate> <asp:label id="lblid" runat="server" text='<%#bind("id") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="client name"> <itemtemplate> <asp:label id="lblname" runat="server" text='<%#bind("client_name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="email"> <itemtemplate> <asp:label id="lblemail" runat="server" text='<%#bind("email") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="google email"> <itemtemplate> <asp:label id="lblgemail" runat="server" text='<%#bind("google_email") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="contact number"> <itemtemplate> <asp:label id="lblcont" runat="server" text='<%#bind("contact_number") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="add"> <itemtemplate> <asp:button id="btnadd" runat="server" text="add" onclick="btnadd_click" /> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="delete"> <itemtemplate> <asp:button id="btndelete" runat="server" commandname="delete" onclick="btndelete_click" text="delete" /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:logistics %>" selectcommand="select * clientrequest" deletecommand="delete clientrequest client_name = @client_name"> <deleteparameters> <asp:parameter name="client_name" type="string" /> </deleteparameters> </asp:sqldatasource>
i getting error of must declare scaler variable on delete command @client_name column in table , bind client_name label on aspx page
delete button used under template field
the error comes sql try execute
delete clientrequest client_name = @client_name
you need provide @client_name
parameter query, work.
Comments
Post a Comment