need help with user and password

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2006
Posts: 2
Reputation: darkmessenger is an unknown quantity at this point 
Solved Threads: 0
darkmessenger darkmessenger is offline Offline
Newbie Poster

need help with user and password

 
0
  #1
Dec 17th, 2006
hi

can anyone help me how to compare user and password from a database like access... for example i have registered a user and password in access then when i input the user to VB and the password it will compare if the user exist and if the password is right for that existing user.... just like a log in system...:cheesy:
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 263
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training

Re: need help with user and password

 
0
  #2
Dec 17th, 2006
Well, I can't go into specifics because I don't know too much about database programming, but I can take a stab at what you'll need to do in order to make it work.

1. Search the database for the entered user name's record. If no match, display a "wrong username" error message. If there is a match:
2. Read that whole user name/password record from the database.
3. Compare the password field to the entered password. If no match, display a "wrong password" error message. If there is a match:
4. Method is complete.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2
Reputation: darkmessenger is an unknown quantity at this point 
Solved Threads: 0
darkmessenger darkmessenger is offline Offline
Newbie Poster

Re: need help with user and password

 
0
  #3
Dec 17th, 2006
what i mean is what can i use? for example

if cbouser.txt = "the user in the database" then
blah

what can i use for the user choosed in the combo box to be compared in the databassed i made so that it will check if its valid or not...what im trying to make is that it has multiple user that can access to it and differend password each..thanks
Last edited by darkmessenger; Dec 17th, 2006 at 7:14 pm. Reason: press wrong button XD
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 7
Reputation: yuckadirri is an unknown quantity at this point 
Solved Threads: 0
yuckadirri yuckadirri is offline Offline
Newbie Poster

Re: need help with user and password

 
0
  #4
Jan 7th, 2007
try this:

databaseName.Open "Select * from TableUserPass where FieldUser like '" & comboUser.text & "'and FieldPass like '" & textPass.text & "',connection,3,3

//Put this in your command button//
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 1
Reputation: dovb is an unknown quantity at this point 
Solved Threads: 0
dovb dovb is offline Offline
Newbie Poster

Re: need help with user and password

 
0
  #5
Jan 29th, 2007
Did you get your simple password system working? I have a similar task: I want certain passwords to open form A and certain passwords to open form B.\

Can you help?
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,117
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 282
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: need help with user and password

 
0
  #6
Jan 29th, 2007
Originally Posted by dovb View Post
Did you get your simple password system working? I have a similar task: I want certain passwords to open form A and certain passwords to open form B.\

Can you help?
Start a new thread (since this one is darkmessenger's) and explain in detail what you need.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 7
Reputation: purplestar86 is an unknown quantity at this point 
Solved Threads: 0
purplestar86's Avatar
purplestar86 purplestar86 is offline Offline
Newbie Poster

Re: need help with user and password

 
0
  #7
Feb 15th, 2007
Originally Posted by yuckadirri View Post
try this:

databaseName.Open "Select * from TableUserPass where FieldUser like '" & comboUser.text & "'and FieldPass like '" & textPass.text & "',connection,3,3

//Put this in your command button//
Hi, may i ask what's the connection for and the 3,3 for? i'm having the same problem. im trying to use what u suggested.

thanks!
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 4
Reputation: hiddenben is an unknown quantity at this point 
Solved Threads: 0
hiddenben hiddenben is offline Offline
Newbie Poster

Re: need help with user and password

 
0
  #8
Feb 20th, 2007
' Well this is a litle example of how to block an user in a system it depend on the way you want 'to do it, because if you want to block an id who put 3 times a wrong password you have to be 'sure if it is the same id he is trying that`s the reason why y block the user
' textbox after he put the rigth id, why i do it to this way? just to show that you can do everything 'you want but you have to know What do you want to do! so you can mix thing to get a better 'login, 'but that's your job! i hope this help you!
  1. ' first you need to textbox named TxtUser and TxtPassword
  2. ' and a command buttom named CmdOK
  3. ' o whatever you want to named!
  4. 'and crate the Database on Access, whit the fields user, password, name and state
  5. ' and put and user to try, example: hiddenben, 1234, hidden, Active
  6. ' make sure is in the Field State to Write 'Active' whitout spaces
  7. ' and put the DB in the same Folder as your Program!
  8.  
  9. ' This Works with Access And Dao, (i prefer ADO is better, but the netx time :mrgreen:)
  10.  
  11. ' Here we Declare our Vars
  1. Dim cn As DAO.Database, rs As DAO.Recordset, intent As Integer
  2. -----------------------------------------------------------------------------
  3. Private Sub Form_Load()
  4. [COLOR=DarkGreen]' we open the database with our Dao var on the form load[/COLOR]
  5. Set cn = OpenDatabase(App.Path & "\Examplelogin.Mdb")
  6. End Sub
  7. -----------------------------------------------------------------------------
  8. Private Sub TxtUser_LostFocus()
  9. [COLOR=DarkGreen]' with this recordset we verify is the user is ok! and state is active! if ' not 3 times we just finish the program and nobody is block[/COLOR]
  10. Set rs = cn.OpenRecordset("Select * From user Where user='" & Me.TxtUser & "' and state = 'Active'", 2, 3)
  11. If rs.EOF = False Then
  12. Me.TxtUser.Enabled = False
  13. intent = 0
  14. [COLOR=DarkGreen]'we put this in 0 because we going to use again to verify password[/COLOR]
  15. rs.Close
  16. Me.TxtPassword.SetFocus
  17. Else
  18. [COLOR=DarkGreen] 'if not we increase then trys and return the focus to the user textbox[/COLOR]
  19. MsgBox "Incorrect", vbInformation + vbOKOnly, "Information"
  20. intent = intent + 1
  21. rs.Close
  22. If intent < 3 Then
  23. Me.TxtUser.SetFocus
  24. Exit Sub
  25. Else
  26. MsgBox "Incorrect Please contact the Administrator", _ vbInformation + vbOKOnly, "Information"
  27. End
  28. End If
  29. End If
  30. End Sub
  31. --------------------------------------------------------------------------------
  32. [COLOR=DarkGreen]' with this recordset we verify is the password is ok! if not 3 times
  33. ' we block the user
  34. [/COLOR]Private Sub CmdOk_Click()
  35.  
  36. Set rs = cn.OpenRecordset("Select * From user Where user='" & _ Me.TxtUser & "' and password='" & Me.TxtPassword & "'", 2, 3)
  37.  
  38. If rs.EOF = False Then
  39. [COLOR=DarkGreen] ' if the user is correct we pass the control to our first Form[/COLOR]
  40.  
  41. MsgBox "Welcome '" & Me.TxtUser & "'", vbInformation + _ vbOKOnly, "Information"
  42.  
  43. Unload Me
  44. rs.Close
  45. MDIForm1.Show
  46. Else
  47. [COLOR=DarkGreen] 'if not we increase then trys and return the focus to the
  48. ' password textbox[/COLOR]
  49. MsgBox "Incorrect", vbInformation + vbOKOnly, "Information"
  50. intent = intent + 1
  51. rs.Close
  52. If intent < 3 Then
  53. Me.TxtPassword.SetFocus
  54. Exit Sub
  55. Else
  56. Call block [COLOR=DarkGreen]'we call the function to block the user[/COLOR]
  57. MsgBox "Incorrect Your UserId is blocked Please contact _ the Administrator", vbExclamation + vbOKOnly, "Wrong"
  58. End
  59. End If
  60. End If
  61. End Sub
  62. -------------------------------------------------------------------------------
  63. [COLOR=DarkGreen]' this is the function that block the user in the Access Database[/COLOR]
  64. Sub block()
  65. [COLOR=DarkGreen]' a simple RecordSet[/COLOR]
  66. Set rs = cn.OpenRecordset("Select * From user Where user='" & Me.TxtUser & "'", 2, 3)
  67. rs.Edit
  68. rs!State = "Blocked" [COLOR=DarkGreen] 'Update the State of the user on the DB[/COLOR]
  69. rs.Update
  70. rs.Close
  71. End Sub
  72. ------------------------------------------------------------------------------
Last edited by WaltP; Feb 21st, 2007 at 3:29 am. Reason: Please use CODE tags -- note the writing on the background of the
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 28
Reputation: mjwest10 is an unknown quantity at this point 
Solved Threads: 3
mjwest10 mjwest10 is offline Offline
Light Poster

Re: need help with user and password

 
0
  #9
Feb 20th, 2007
Last edited by mjwest10; Feb 20th, 2007 at 6:38 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC