Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,415 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,418 people online right now. Registration is fast and FREE... Join Now!




Login, username and password from database

 
Reply to this topicStart new topic

Login, username and password from database

sastre06
15 Oct, 2008 - 07:04 AM
Post #1

New D.I.C Head
Group Icon

Joined: 5 Jun, 2007
Posts: 45


Dream Kudos: 50
My Contributions
I have a problem with my log on screen, when i type my username and password on txtuser and txtpass textbox, including a single space after the username/password(no matter how many spaces in txtuser/txtpass), the log on screen accepted it as a correct username/password.
i don't know what was the problem.

sample:
txtuser.text="administrator "
txtpass.text="admin "

the word "administrator" and the word "admin" is the correct username/password, i have already check my database and there was no space on my username/password.

CODE


If txtuser.Text = "" Or txtpass.Text = "" Then
    MsgBox "Please Fill The Fields First   ", vbInformation + vbOKOnly, "Field Required"
    txtuser.SetFocus
Else
    CON.Open "provider=microsoft.jet.oledb.4.0; data source=" & App.Path & "\Database\data.mdb"
    rs.Open "select * from tbluser where username='" & txtuser.Text & "' and password='" & txtpass.Text & "'", CON, adOpenKeyset, adLockOptimistic
    If rs.RecordCount = 1 Then
    
       Load frmtimeanddate
       frmtimeanddate.Show
       Unload frmlogin
       CON.Close
    Else
        MsgBox "Wrong Username or Password, please try again", vbInformation + vbOKOnly, "Access Denied"
        retries = retries - 1
                             If retries = 0 Then
                             MsgBox "This system will automatically close after 3 wrong attempts", vbExclamation, "info"
                  
                             Unload Me
                             End If
        rs.Close
        CON.Close
    End If
End If



This post has been edited by sastre06: 15 Oct, 2008 - 07:07 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 12:48PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month