943,917 Members | Top Members by Rank

Ad:
Feb 21st, 2009
0

login system

Expand Post »
help how can i know if the user is not an admin

i have combo box in my combo box have a user or admin additem if he choose admin then all i want is to validate if the username and password is for admin user this is my code

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Form_Load()
  2. Call Opencn
  3. With Combo1
  4. .AddItem ("Administrator")
  5. .AddItem ("User")
  6. End With
  7. End Sub
  8.  
  9. Private Sub lvButtons_H1_Click()
  10. Set rs = New ADODB.Recordset
  11. rs.Open "SELECT * FROM Login WHERE UserName = '" & Text1.Text & "' AND Password = '" & Text2.Text & "'", cn, adOpenKeyset, adLockPessimistic
  12. If Combo1.Text = "Administrator" Then
  13. If rs.RecordCount > 0 Then
  14. frmBegin.Label4.Caption = rs!Fullname
  15. frmBegin.Show
  16. Unload Me
  17. Exit Sub
  18. Else
  19. MsgBox "Your Username or Password is incorrect", vbCritical
  20. End If
  21. End If
  22. End Sub
Similar Threads
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Feb 21st, 2009
0

Re: login system

Click to Expand / Collapse  Quote originally posted by ryan311 ...
help how can i know if the user is not an admin

i have combo box in my combo box have a user or admin additem if he choose admin then all i want is to validate if the username and password is for admin user this is my code
please post clearly using correct english and grammer.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Feb 21st, 2009
-1

Re: login system

help how can i know if the user is not an admin

i have combo box, in my combo box have a user or admin additem, if he choose admin then all i want is to validate if the username and password is for admin user, this is my code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Form_Load()
  2. Call Opencn
  3. With Combo1
  4. .AddItem ("Administrator")
  5. .AddItem ("User")
  6. End With
  7. End Sub
  8.  
  9. Private Sub lvButtons_H1_Click()
  10. Set rs = New ADODB.Recordset
  11. rs.Open "SELECT * FROM Login WHERE UserName = '" & Text1.Text & "' AND Password = '" & Text2.Text & "'", cn, adOpenKeyset, adLockPessimistic
  12. If Combo1.Text = "Administrator" Then
  13. If rs.RecordCount > 0 Then
  14. frmBegin.Label4.Caption = rs!Fullname
  15. frmBegin.Show
  16. Unload Me
  17. Exit Sub
  18. Else
  19. MsgBox "Your Username or Password is incorrect", vbCritical
  20. End If
  21. End If
  22. End Sub
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Feb 22nd, 2009
0

Re: login system

how you decide if the user is an admin user or not ?

what is the logic for that ?

is there is corresponding field for that value as well ?
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: please help badly needed!
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help Please: data type mismatch in criteria expression





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC