I use the following code in my login form. but it doesn’t care about cases. Just like admin or Admin or whether ADmin as username can either login to my system when the real one is admin. these are my code:
sql = "SELECT * FROM tblStaff WHERE Username = @User AND Password = @Pass"
myCommand = New SqlCommand(sql, myConnection)
myCommand.Parameters.AddWithValue("@User", txtUser.Text)
myCommand.Parameters.AddWithValue("@Pass", txtPassword.Text)
myCommand.ExecuteReader()
……….
Please help.
If you want to be case insensitive then the following should work for you:
EDIT:
If you want the username to be case insensitive and the password to be case sensitive then the following should work for you:
If you want the username and password to be case sensitive then try the following: