/// <summary> /// 修改成绩 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateCj_Click(object sender, EventArgs e) { int k = this.groupBox1.Controls.Count; List <ExaminationModel> list = new List <ExaminationModel>(k); for (int i = 0; i < k; i++) { ExaminationModel exa = new ExaminationModel(); UserControl1 user = (UserControl1)groupBox1.Controls[i]; exa.SubjectsID = Convert.ToInt32(user.labSubjectName.Tag); exa.ExamScore = int.Parse(user.txtExamination.Text.Trim()); exa.StudentID = int.Parse(this.labStuID.Text); list.Add(exa); } int count = examin.UpdateExamination(k, list); if (count == k) { MessageBox.Show("成绩修改成功"); BindGrade(); } else { MessageBox.Show("成绩修改失败"); } }