private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (true) { string cid = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); CourseBLL bll = new CourseBLL(); bool b = bll.DeleteStuCourse(sid, cid); if (b) { MessageBox.Show("退课成功"); LoadMyCourse(); } else { MessageBox.Show("退课失败"); } } }