private void butOK_Click(object sender, EventArgs e) { //Application.EnableVisualStyles(); //kết nối csdl , kiểm tra user name, pass word this.Hide(); formManage ql = new formManage(); ql.Show(); }
private void butOK_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand(); command.Connection = con; command.CommandType = CommandType.Text; command.CommandText = "Select username,pass from NHANVIEN where (username=@user) and (pass=@pass)"; command.Parameters.Add("@user", SqlDbType.NVarChar, 50).Value = boxUname.Text; command.Parameters.Add("@pass", SqlDbType.NVarChar, 50).Value = boxPword.Text; da.SelectCommand = command; da.Fill(dt); if (dt.Rows.Count > 0) { formManage ql = new formManage(); ql.Show(); Hide(); } else { MessageBox.Show("Đăng nhập thất bại. Sai mật khẩu hoặc tên tài khoản"); } }