Hi guys,
I've created a login form which works fine, i need assistance in comparing uppercase and lowercase input from a login form. Whenever the password is entered, the system has to compare uppercase and lowercase characters stored in the data..following is my code:
'Logic for login...
Dim conn As New OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
Dim selectQuery As String
Dim dr As OleDb.OleDbDataReader
Dim userProfile As String
Dim MainrMenur As New frmMainrMenur
Try
conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Video Store\Video Store\DvDSystem.mdb")
conn.Open()
selectQuery = "SELECT * FROM Userr WHERE [UserID] = '" & txtUserName.Text & "' AND [User Password] = '" & txtUserPassword.Text & "'"
cmd = New OleDb.OleDbCommand(selectQuery, conn)
dr = cmd.ExecuteReader()
'conn.Open()
'if successfull then log in
If dr.Read() Then
'Get user profile
userProfile = dr.GetString(3)
keptProfile = userProfile
MainrMenur.Show()
If keptProfile = "admin" Then
MainrMenur.Show()
End If
ElseIf txtUserName.Text <> "" Then
If txtUserPassword.Text <> "" Then
MessageBox.Show("Wrong login, please try again ...", "Login Denied", MessageBoxButtons.OK)
Else
MessageBox.Show("Please enter password", "Login Error", MessageBoxButtons.OK)
txtUserPassword.Focus()
End If
Else
MessageBox.Show("Please enter user id", "Login Error", MessageBoxButtons.OK)
txtUserName.Focus()
End If
'Clear password field after login
txtUserPassword.Clear()
dr.Close()
Catch ex As Exception
MessageBox.Show("Please exit system and login again.", "Login Error", MessageBoxButtons.OK)
End Try
conn.Close()