private void Login_but_ok_Click(object sender, EventArgs e) { //Kiểm tra csdl để đăng nhập //đăng nhập ok: QL_Form qlfomr = new QL_Form(); qlfomr.Show(); this.Hide(); }
private void Login_but_ok_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 = textBox1.Text; command.Parameters.Add("@pass", SqlDbType.NVarChar, 50).Value = Login_box_pword.Text; da.SelectCommand = command; da.Fill(dt); if (dt.Rows.Count > 0) { QL_Form ql = new QL_Form(); 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"); } //kiem tra csdl xem co nguoi dung }