求助最简单的delete语句
string sql=int.Form("delete from T1 where ID='{0}'",n)
其中ID是主键,若n是选中行ID的值,怎么得到n?
其实就是怎么得到鼠标选中行的主键值?
各位大神,帮帮忙吧,我新手菜鸟
[解决办法]
<script type="text/javascript"> function checkDelete() { return confirm('是否删除?'); } </script> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand" > <Columns> <asp:BoundField DataField="ID" HeaderText="编号" /> <asp:BoundField DataField="NameL" HeaderText="名称" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="lkBtnDelete" runat="server" Text="删除" CommandArgument='<%# Eval("ID") %>' CommandName="delRow" OnClientClick="return checkDelete()"></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>