User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,524 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,474 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2684 | Replies: 8
Reply
Join Date: Dec 2006
Posts: 2
Reputation: darkmessenger is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
darkmessenger darkmessenger is offline Offline
Newbie Poster

Help need help with user and password

  #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:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: NY
Posts: 196
Reputation: Dukane is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 15
Dukane's Avatar
Dukane Dukane is offline Offline
Junior Poster

Re: need help with user and password

  #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  
Join Date: Dec 2006
Posts: 2
Reputation: darkmessenger is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
darkmessenger darkmessenger is offline Offline
Newbie Poster

Re: need help with user and password

  #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 6:14 pm. Reason: press wrong button XD
Reply With Quote  
Join Date: Jan 2007
Posts: 7
Reputation: yuckadirri is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
yuckadirri yuckadirri is offline Offline
Newbie Poster

Re: need help with user and password

  #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  
Join Date: Jan 2007
Posts: 1
Reputation: dovb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dovb dovb is offline Offline
Newbie Poster

Re: need help with user and password

  #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  
Join Date: May 2006
Posts: 2,700
Reputation: WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold 
Rep Power: 14
Solved Threads: 219
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Maven

Re: need help with user and password

  #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.
Age is unimportant -- except in cheese
Reply With Quote  
Join Date: Dec 2006
Posts: 7
Reputation: purplestar86 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
purplestar86's Avatar
purplestar86 purplestar86 is offline Offline
Newbie Poster

Re: need help with user and password

  #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  
Join Date: Feb 2007
Posts: 4
Reputation: hiddenben is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hiddenben hiddenben is offline Offline
Newbie Poster

Re: need help with user and password

  #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 2:29 am. Reason: Please use CODE tags -- note the writing on the background of the
Reply With Quote  
Join Date: Feb 2007
Posts: 27
Reputation: mjwest10 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
mjwest10 mjwest10 is offline Offline
Light Poster

Re: need help with user and password

  #9  
Feb 20th, 2007
Last edited by mjwest10 : Feb 20th, 2007 at 5:38 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 7:08 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC