Example #1
0
        private void btnDangnhap_Click(object sender, EventArgs e)
        {
            if (cboTendangnhap.Text == "")
            {
                MessageBox.Show("Bạn phải nhập tên đăng nhập", "Thông báo");
                cboTendangnhap.Focus();
                return;
            }
            if (txtMatkhau.Text == "")
            {
                MessageBox.Show("Bạn phải nhập mật khẩu", "Thông báo");
                txtMatkhau.Focus();
                return;
            }
            string    sql   = "select * from tblDangnhap where Tendangnhap=N'" + cboTendangnhap.Text + "'and Matkhau =N'" + txtMatkhau.Text + "'";
            DataTable table = ThucthiSQL.DocBang(sql);

            if (table.Rows.Count > 0)
            {
                MaCV = table.Rows[0][2].ToString();
                this.Hide();
                Forms.frmMain f = new Forms.frmMain();
                f.StartPosition = FormStartPosition.CenterScreen;
                f.Show();
            }
            else
            {
                MessageBox.Show("Sai tên tài khoản hoặc mật khẩu. Bạn hãy nhập lại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cboTendangnhap.Text = "";
                txtMatkhau.Text     = "";
                cboTendangnhap.Focus();
            }
        }
Example #2
0
 private void cbTendangnhap_DropDown(object sender, EventArgs e)
 {
     cboTendangnhap.DataSource    = ThucthiSQL.DocBang("select Tendangnhap from tblDangnhap");
     cboTendangnhap.ValueMember   = "Tendangnhap";
     cboTendangnhap.SelectedIndex = -1;
 }