예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            StudentInfoData data = new StudentInfoData();

            data.Sno   = txtSno.Text;
            data.Sname = txtSname.Text;
            if (rdoMale.Checked)
            {
                data.Sex = rdoMale.Text;
            }
            else
            {
                data.Sex = rdoFemale.Text;
            }
            data.Birthday = txtBirthday.Text;
            data.Classid  = txtClassid.Text;
            data.Tel      = txtTel.Text;
            data.Address  = txtAddress.Text;
            if (txtSno.Text == "" || txtSno.Text == null)
            {
                MessageBox.Show("学号不能为空");
                txtSno.Focus();
                return;
            }
            Classes.StudentInfoOperation op = new Classes.StudentInfoOperation();

            if (op.InsertStudentInfo(data))
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }
예제 #2
0
        DataSet Bind()
        {
            StudentInfoData data = new StudentInfoData();

            data.Sno     = txtSno.Text;
            data.Sname   = txtSname.Text;
            data.Sex     = txtSex.Text;
            data.Classid = txtClass.Text;
            Classes.StudentInfoOperation op = new Classes.StudentInfoOperation();
            ds = op.GetStudentInfo(data);
            return(ds);
        }
예제 #3
0
        //删除
        private void button3_Click(object sender, EventArgs e)
        {
            string sno = txtSno1.Text;

            Classes.StudentInfoOperation op = new Classes.StudentInfoOperation();
            if (op.DeleteStudent(sno))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }
예제 #4
0
        //修改
        private void button2_Click(object sender, EventArgs e)
        {
            StudentInfoData data = new StudentInfoData();

            data.Sno      = txtSno1.Text;
            data.Sname    = txtSname1.Text;
            data.Sex      = txtSex1.Text;
            data.Birthday = txtBirthday1.Text;
            data.Classid  = txtClass.Text;
            data.Tel      = txtTel1.Text;
            data.Address  = txtAddress1.Text;
            Classes.StudentInfoOperation op = new Classes.StudentInfoOperation();
            if (op.UpdateStudent(data))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }