示例#1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            TaiKhoan tk = database.TaiKhoans.SingleOrDefault(n => n.TenDangNhap == txtTenDangNhap.Text && n.MatKhau == txtMatKhau.Text);

            if (tk == null)
            {
                MessageBox.Show("Tài khoản hoặc mật khẩu sai mời đăng nhập lại");
                return;
            }
            else
            {
                frmMain f = new frmMain();
                f.Show();
                this.Hide();
            }
        }
示例#2
0
 private void bntOK_Click(object sender, EventArgs e)
 {
     SqlCommand command = new SqlCommand();
     command.Connection = con;
     command.CommandType = CommandType.Text;
     command.CommandText = "Select * From tblDangNhap Where (Taikhoan=@user) And (matkhau=@password)";
     command.Parameters.Add("@user", SqlDbType.NVarChar, 50).Value = txtTaiKhoan.Text;
     command.Parameters.Add("@password", SqlDbType.NVarChar, 50).Value = txtMatKhau.Text;
     da.SelectCommand = command;
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         MessageBox.Show("Dang nhap thanh cong");
         Hide();
         frmMain main = new frmMain();
         main.Show();
     }
     else
     {
         MessageBox.Show("Đăng nhập thất bại");
     }
 }
示例#3
0
        private void bntOK_Click(object sender, EventArgs e)
        {
            SqlCommand command = new SqlCommand();

            command.Connection  = con;
            command.CommandType = CommandType.Text;
            command.CommandText = "Select * From tblDangNhap Where (Taikhoan=@user) And (matkhau=@password)";
            command.Parameters.Add("@user", SqlDbType.NVarChar, 50).Value     = txtTaiKhoan.Text;
            command.Parameters.Add("@password", SqlDbType.NVarChar, 50).Value = txtMatKhau.Text;
            da.SelectCommand = command;
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("Dang nhap thanh cong");
                Hide();
                frmMain main = new frmMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Đăng nhập thất bại");
            }
        }
示例#4
0
        private void btnThoat_Click_1(object sender, EventArgs e)
        {
            frmMain frm = new frmMain();

            frm.Show();
        }
示例#5
0
 private void HoSo_Click(object sender, EventArgs e)
 {
     Form frm1 = new frmMain();
     frm1.Show();
     Hide();
 }