日期:2014-05-17 浏览次数:20823 次
private void button6_Click(object sender, EventArgs e)
{
int selectedRows = dataGridView2.SelectedRows.Count;
for (int j = 0; j < selectedRows; j++)
{
try
{
if (dataGridView2.Rows[j].Cells["选择"].Value != null)
{
if (bool.Parse(dataGridView2.Rows[j].Cells["选择"].Value.ToString()) == true)
{
MessageBox.Show("123");
string DElsql = string.Format("Delete From Question Where QuestionID = {0}", Convert.ToInt32(dataGridView2.SelectedRows[0].Cells["题号"].Value));
conn.Open();
SqlCommand cmd = new SqlCommand(DElsql, conn);
cmd.ExecuteNonQuery();
conn.Close();
dataview();
}
}
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}