DataGridViewCheckBoxColumn获得选中状态
biao1 2007-05-09 07:04:03 WinForm中DataGridViewCheckBoxColumn这个列,我是通过他的选中然后点button来删除一个列的,这个代码怎么写呢? 大家说说思路
我在网上找的,代码 不过不行
private void button2_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.RowCount; i++)
{
string re_value = dataGridView1.Rows[i].Cells[0].EditedFormattedValue.ToString();
if (re_value == "True")//判断勾选的
{
string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += "Data Source=";
strConnection += Application.StartupPath + (@"\CMT.mdb");
OleDbConnection conn = new OleDbConnection(strConnection);
conn.Open();
OleDbCommand cmd = new OleDbCommand("delete from foa_Personnel where.....", conn);
cmd.ExecuteNonQuery();
MessageBox.Show("成功!");
}
else
{
continue;
}
}
}
sql语句的where条件怎么写?