[求助]asp.net 在datagrid中怎样删除记录
请问各位大侠!!! 在datagrid中怎样删除记录?????????????????
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string id = this.DataGrid1.DataKeys[0].ToString();
// Add code to delete row from data source.
string sqlconn=ConfigurationSettings.AppSettings["connString"];
SqlConnection myConnection=new SqlConnection(sqlconn);
myConnection.Open();
String strSQL="delete from client " +" WHERE client_id = " + id ;
SqlCommand cm=new SqlCommand(strSQL,myConnection);
cm.ExecuteNonQuery();
myConnection.Close();
DataGrid1.EditItemIndex =-1;
//LoadGrid();
}