Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim sql = "SELECT username,password FROM admin WHERE username = '" & TextBox1.Text & "' AND password = '" & TextBox2.Text & "'"
- cmd = New OleDbCommand(sql, connection)
- connection.Open()
- Dim dr As OleDbDataReader = cmd.ExecuteReader
- Try
- connection.Open()
- Catch ex As InvalidOperationException
- End Try
- Try
- If dr.Read = False Then
- MsgBox("Incorrect Details", MsgBoxStyle.Critical, "Administrator")
- TextBox1.Text = ""
- TextBox2.Text = ""
- WrongPassword = WrongPassword + 1
- If WrongPassword = 3 Then
- MsgBox("SORRY! you reach 3 times attempt, Program Exit", vbCritical, "LOGIN FAILED: SYSTEM CLOSED")
- Me.Close()
- End If
- Else
- TextBox1.Clear()
- TextBox2.Clear()
- MsgBox("Login Successful", MsgBoxStyle.Information, "Administrator")
- mMenu.Show()
- Me.Hide()
- End If
- Catch ex As Exception
- End Try
- If connection.State <> ConnectionState.Closed Then
- connection.Close()
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement