Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            StuGradeData data = new StuGradeData();

            data.Sno            = txtSno.Text;
            data.Cno            = txtCno.Text;
            data.Gradepeacetime = float.Parse(txtGradepeacetime.Text);
            data.Gradeexpriment = float.Parse(txtGradeexpriment.Text);
            data.Gradelast      = float.Parse(txtGradelast.Text);
            data.Grade          = float.Parse(txtGrade.Text);
            if (txtSno.Text == "" || txtSno.Text == null)
            {
                MessageBox.Show("学号不能为空");
                txtSno.Focus();
                return;
            }
            Classes.StuGradeOperation op = new Classes.StuGradeOperation();

            if (op.InsertStuGrade(data))
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }
Example #2
0
        DataSet Bind()
        {
            StuGradeData data = new StuGradeData();

            data.Sno = txtSno.Text;
            data.Cno = txtCno.Text;

            Classes.StuGradeOperation op = new Classes.StuGradeOperation();
            ds = op.GetStuGrade(data);
            return(ds);
        }
Example #3
0
        //修改
        private void button2_Click(object sender, EventArgs e)
        {
            StuGradeData data = new StuGradeData();

            data.Sno            = txtSno1.Text;
            data.Cno            = txtCno1.Text;
            data.Gradepeacetime = float.Parse(txtGradepeacetime1.Text);
            data.Gradeexpriment = float.Parse(txtGradeexpriment1.Text);
            data.Gradelast      = float.Parse(txtGradelast1.Text);
            data.Grade          = float.Parse(txtGrade1.Text);

            Classes.StuGradeOperation op = new Classes.StuGradeOperation();
            if (op.UpdateStuGrade(data))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }