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