![]() |
#2
tangyunzhong2011-09-03 16:47
回复 楼主 whise178com
|

int of = dataGridView1.CurrentRow.Index;
dataGridView1.Rows.RemoveAt(of);
string str="delete from Table5 where IID="+of+"";
SqlCommand com = new SqlCommand(str, con);
SqlDataAdapter data = new SqlDataAdapter();
data.DeleteCommand = com;
//data.Update(ds);
MessageBox.Show("删除成功!", "消息", MessageBoxButtons.OK);
只能删除dataGridBiew1的显示的数据,实际表里的没有删除,这里哪里有问题? dataGridView1.Rows.RemoveAt(of);
string str="delete from Table5 where IID="+of+"";
SqlCommand com = new SqlCommand(str, con);
SqlDataAdapter data = new SqlDataAdapter();
data.DeleteCommand = com;
//data.Update(ds);
MessageBox.Show("删除成功!", "消息", MessageBoxButtons.OK);