Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB
Dear friends
I was trying to make a login form in vb6 and access 2007. It worked fine but it is not case sensitive. If i type username or password in lower case or uppercase it is logging me in.
How can i make it case sensitive.
It it possible on Vb6.
I tried strcomp() but no success.
Please help
 
Sarfaraz
Posted 24-Dec-12 5:52am
Comments
Ashok19r91d at 28-Dec-12 0:09am
   
What's the Query you Used to Retrieve login Details?
Comment out Here... It helps to Understand your Faults better...
sarfarazbhat at 31-Dec-12 1:04am
   
Sir Pls Reply and help me in this regard!
sarfarazbhat at 28-Dec-12 8:50am
   
Connection

Set rs = New ADODB.Recordset
rs.Open "select * from login where Username='" & Text1.Text & "'" _
& " and Password='" & Text2.Text & "'", Con, adOpenDynamic, adLockOptimistic
Text1.SetFocus

If Not rs.EOF Then

MsgBox "OK"


Else
MsgBox "Invalid username or password", vbInformation, "Login..."
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus

rs.Close
End If
I tried this the following function also but no success
StrComp(strVal1, strVal2, vbTextCompare)
StrComp(strVal1, strVal2, vbBinaryCompare)
StrComp(strVal1, strVal2, vbDatabaseCompare)
Ashok19r91d at 31-Dec-12 1:18am
   
I've Updated SOlution, Comeback and Check...
Don't forget to Accept Solution if it Works...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
sarfarazbhat at 24-Dec-12 12:34pm
   
No success. Since i need to check the username and password from the access database table.
Please if you can give some code as how to check the textbox(username) and textbox(password) and compare the values from login table in Access 2007.
Thanks
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Your Mistake is that you've Send Username with Password to Check in Database,
All SQL Queries and it's Paramaeters are not Case Sensitive...
So Now I've Updated your Source Which send UserName to Database and Retrieve Password from it, After that You can compare both text using Simple IF condition...
Here's my Solution, It'll work...
 
Set rs = New ADODB.Recordset
Qry = "SELECT Password FROM Login WHERE UserName = '" & Text1.Text & "'"
rs.Open Qry, Con, adOpenDynamic, adLockOptimistic    
If Not rs.EOF Then
    If rs(0) = Text2.Text Then  ' rs(0) may be written as rs.Fields(0) try both
        MsgBox "OK" 
    Else
        Msgbox "Invalid Username or Password", vbInformation, "Login..."
    End If
Else
    MsgBox "Invalid Username or Password", vbInformation, "Login..."
    Text1.Text = ""
    Text2.Text = ""
End If
rs.Close
Text1.SetFocus     
  Permalink  
Comments
sarfarazbhat at 31-Dec-12 12:25pm
   
Thank you soooo much sir.
Wish you a very happy and prosperous new year 2013.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi Sarfaraz
 
You are doing well,For archive that, do one more thing write a function for encryption and decryption
 
Encrypt it, while storing username and password.
 
During log in, first you have to encrypt the user name and password for comparison.
 
If you want to show User Name some where like Audit trail at that time you have to Decrypt the username.
 
Find below link for encryption/Decryption....
http://support.microsoft.com/kb/821762[^]
http://www.developerfusion.com/code/157/encryptdecrypt/[^]
 
Regards,
Vijay
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100