private void button3_Click(object sender, EventArgs e)
        {
            string chuoi;

            chuoi = txtMaSV.Text;
            if (kiemtratontai())
            {
                MessageBox.Show("Mã sv đã tồn tại. Vui lòng nhập lại !");
            }
            else
            {
                if (txtMaSV.Text == "")
                {
                    MessageBox.Show("Bạn phải nhập mã sv");
                }
                //else if (chuoi.Length != 4)
                //{
                //    MessageBox.Show("Bạn phải nhập đúng 4 ký tự");
                //}
                else
                {
                    string     theDate = dateTimePicker1.Value.ToString("MM/dd/yyyy");
                    string     them    = "insert into DMSV values ('" + txtMaSV.Text + "','" + txtTenSV.Text + "','" + txtGioiTinh.Text + "','" + theDate + "','" + txtNoiSinh.Text + "','" + txtMaLop.Text + "') select MaSV,MaLop from DMSV where MaLop = '" + txtMaLop.Text + "'";
                    SqlCommand comThem = new SqlCommand(them, con);
                    comThem.ExecuteNonQuery();
                    getdata();
                    MessageBox.Show("Thêm mới thành công ");
                    this.Close();
                    frmSinhVien tg = new frmSinhVien();
                    tg.ShowDialog();
                }
            }
        }
Example #2
0
        private void thôngTinMượnTrảToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSinhVien sv = new frmSinhVien();

            sv.Show();
        }