If login_attempts = 2 Then
MsgBox(“You have exceeded the Number of Attempts allowed”, MsgBoxStyle.Critical, “Invalid Login Attempts”)
End
End If
Dim qryString, acc_ative, admin_type As String
Dim connection As OleDb.OleDbConnection = New OleDb.OleDbConnection
qryString = “SELECT * FROM tblEmployee_Users WHERE Emp_Username=”
qryString = qryString & “‘” & txtUsername.Text & “‘”
qryString = qryString & ” AND Emp_password=” & “‘” & txtPassword.Text & “‘”
DbConnect(connection) ‘connecting to database
Dim Command1 As OleDb.OleDbCommand = New OleDb.OleDbCommand(qryString)
Command1.CommandType = CommandType.Text
Command1.Connection = connection
Dim Reader1 As OleDb.OleDbDataReader = Command1.ExecuteReader()
Dim user_type As String
If Reader1.HasRows Then
While (Reader1.Read())
admin_type = Reader1(“Emp_Is_Admin”).ToString
acc_ative = Reader1(“Emp_Acct_Active”).ToString
user_type = admin_type
If admin_type.Equals(“True”) Then
usertype_admin = True
Else
usertype_admin = False
End If
If acc_ative.Equals(“True”) Then
loged_on = txtUsername.Text
txtUsername.Text = “”
txtPassword.Text = “”
frmMenu.Show()
Me.Hide()
End If
End While
Else
txtUsername.BackColor = Color.Red
txtPassword.BackColor = Color.Red
txtUsername.Focus()
login_attempts = login_attempts + 1
End If
DbDisconnect(connection)