Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim cn As New SqlConnection("Data Source=TANSENGCOSQLEXPRESS;Initial Catalog=MonitoringSystem;Integrated Security=True")
- Dim cmd As New SqlCommand
- Dim rd As SqlDataReader
- Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
- cmd.Connection = cn
- cn.Open()
- cmd.CommandText = "SELECT username, password FROM tblUsers WHERE username = '" & txtUsername.Text & "' and password = '" & txtPassword.Text & "'"
- rd = cmd.ExecuteReader
- If rd.HasRows Then
- Me.Hide()
- frmMainMenu.Show()
- Else
- MsgBox("Invalid Credentials", MsgBoxStyle.Exclamation, "Invalid LogIn")
- End If
- cn.Close()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement