コード例 #1
0
ファイル: StudentAdd.cs プロジェクト: ZHoodLum/studentmanger
        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 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];
        }