Advertisement
Guest User

Untitled

a guest
Sep 11th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. Dim cn As New SqlConnection("Data Source=TANSENGCOSQLEXPRESS;Initial Catalog=MonitoringSystem;Integrated Security=True")
  2. Dim cmd As New SqlCommand
  3. Dim rd As SqlDataReader
  4. Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
  5. cmd.Connection = cn
  6. cn.Open()
  7. cmd.CommandText = "SELECT username, password FROM tblUsers WHERE username = '" & txtUsername.Text & "' and password = '" & txtPassword.Text & "'"
  8. rd = cmd.ExecuteReader
  9. If rd.HasRows Then
  10. Me.Hide()
  11. frmMainMenu.Show()
  12. Else
  13. MsgBox("Invalid Credentials", MsgBoxStyle.Exclamation, "Invalid LogIn")
  14. End If
  15. cn.Close()
  16. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement