Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string chuoi;

            chuoi = txtMaMonHoc.Text;
            if (kiemtratontai())
            {
                MessageBox.Show("Mã khoa đã tồn tại. Vui lòng nhập lại !");
            }
            else
            {
                if (txtMaMonHoc.Text == "")
                {
                    MessageBox.Show("Bạn phải nhập mã khoa");
                }
                //else if (chuoi.Length != 4)
                //{
                //    MessageBox.Show("Bạn phải nhập đúng 4 ký tự");
                //}
                else
                {
                    string     them    = "insert into DMMonHoc values ('" + txtMaMonHoc.Text + "',N'" + txtTenMonHoc.Text + "','" + txtSoTinChi.Text + "','" + comboBox1.Text + "')";
                    SqlCommand comThem = new SqlCommand(them, con);
                    comThem.ExecuteNonQuery();
                    getdata();
                    MessageBox.Show("Thêm mới thành công ");
                    this.Close();
                    frmDMMonHoc tg = new frmDMMonHoc();
                    tg.ShowDialog();
                }
            }
        }
        private void thôngTinTácGiảToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmDMMonHoc a = new frmDMMonHoc();

            a.Show();
        }