伪代码
private void toolStripMenuItem2_Click(object sender, EventArgs e) { dataGridViewFuture dataGridView1.DataSource = db.ExecuteDataView(sqlDataFuture); }
解决方案
100
上面有问题,这样才对
if (this.dataGridView1.SelectedRows.Count > 0) { //遍历所选中的dataGridView记录行 foreach (DataGridViewRow row in this.dataGridView1.SelectedRows) { //取dataGridView1中的第一列的值 string id= row.Cells[0].Value.ToString(); string sql = "delete tb where id="+id+""; db.ExecuteNonQuery(sql); } }