DATAGRID 删除功能事件
string id=this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();SqlConnection con=new SqlConnection();
con.Open();
SqlCommand cmd=new SqlCommand("delete from mytest where id='"+id+"'",con);
cmd.ExecuteNonQuery();
this.DataBindToDataGrid();
谁帮俺看看,老是提示“索引超出范围。必须为非负值并小于集合大小。参数名: index
”