private void btn_login_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(conn); con.Open(); SqlCommand cmd = new SqlCommand("select count(*) from NguoiDung where Taikhoan = '" + txt_taikhoan.Text + "'and Matkhau = '" + txt_matkhau.Text + "'", con); int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString()); con.Close(); if (temp == 1) { MessageBox.Show("Đăng nhập thành công!"); HeThong form1 = new HeThong(); form1.Show(); this.Hide(); } else { MessageBox.Show("Sai tên tài khoản hoặc mật khẩu!"); } }