Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlStr  = "update Student_course set Score = " + textBox2.Text + " where id='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
            int    Succnum = MyTool.executeCommand(sqlStr);

            if (Succnum > 0)
            {
                MessageBox.Show("录入成功");
            }
            StudentList_SelectedIndexChanged(sender, e);
        }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("您确认要删除该记录吗?", "确认", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
     {
         string sqlStr  = "update Student_course set Score=null where id='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
         int    Succnum = MyTool.executeCommand(sqlStr);
         if (Succnum > 0)
         {
             MessageBox.Show("删除成功");
         }
         StudentList_SelectedIndexChanged(sender, e);
     }
 }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string studentId = MyTool.getStudentIdByStudentName(StudentList.Text);
            string courseId  = MyTool.getCourseIdByCourseName(CourseList.Text);
            string sqlStr    = "insert into Student_course(Student_id,Course_id) values ('" + studentId + "','" + courseId + "')";
            int    Succnum   = MyTool.executeCommand(sqlStr);

            if (Succnum > 0)
            {
                MessageBox.Show("录入成功");
            }
            StudentList_SelectedIndexChanged(sender, e);
        }