Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.24 KB | None | 0 0
  1. Dim sql = "SELECT username,password FROM admin WHERE username = '" & TextBox1.Text & "' AND password = '" & TextBox2.Text & "'"
  2.         cmd = New OleDbCommand(sql, connection)
  3.         connection.Open()
  4.         Dim dr As OleDbDataReader = cmd.ExecuteReader
  5.         Try
  6.             connection.Open()
  7.  
  8.         Catch ex As InvalidOperationException
  9.  
  10.         End Try
  11.  
  12.         Try
  13.  
  14.             If dr.Read = False Then
  15.                 MsgBox("Incorrect Details", MsgBoxStyle.Critical, "Administrator")
  16.                 TextBox1.Text = ""
  17.                 TextBox2.Text = ""
  18.                 WrongPassword = WrongPassword + 1
  19.                 If WrongPassword = 3 Then
  20.  
  21.                     MsgBox("SORRY! you reach 3 times attempt, Program Exit", vbCritical, "LOGIN FAILED: SYSTEM CLOSED")
  22.                     Me.Close()
  23.                 End If
  24.  
  25.  
  26.             Else
  27.                 TextBox1.Clear()
  28.                 TextBox2.Clear()
  29.                 MsgBox("Login Successful", MsgBoxStyle.Information, "Administrator")
  30.                 mMenu.Show()
  31.                 Me.Hide()
  32.             End If
  33.  
  34.         Catch ex As Exception
  35.  
  36.  
  37.         End Try
  38.  
  39.         If connection.State <> ConnectionState.Closed Then
  40.             connection.Close()
  41.  
  42.         End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement