コード例 #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("失败");
            }
        }