Validating password/login via ADO 
Author Message
 Validating password/login via ADO

I kow this is probably an oversight somewhere on my part but I am having a
problem trying to validate both the password and username through the ADO.
Can someone help me out.

Thanks



Tue, 14 Oct 2003 14:26:49 GMT  
 Validating password/login via ADO

...and the problem is?


Quote:
> I kow this is probably an oversight somewhere on my part but I am having a
> problem trying to validate both the password and username through the ADO.
> Can someone help me out.

> Thanks



Wed, 15 Oct 2003 05:46:23 GMT  
 Validating password/login via ADO
Can I use multiple parameters in the select statement to match username and
password values in the database. I can only get it to match on one field
then try to use the field in the recordset to match the other.


Quote:
> I kow this is probably an oversight somewhere on my part but I am having a
> problem trying to validate both the password and username through the ADO.
> Can someone help me out.

> Thanks



Wed, 15 Oct 2003 07:07:55 GMT  
 Validating password/login via ADO
Michael:

Since you are working with ADO I suggest to create a class object which
deals with the DB session. Something like this:

create a class module and name it dbSession.cls (or whatever you want to
name it)

Public Function CheckLogin(ByVal userID As String, ByVal password As String)
As Boolean
        Dim conn As ADODB.Connection
        Set conn = GetConn()        '*call connection using GetConn method
of the object
        If conn Is Nothing Then Exit Function

        Dim sSQL As String
        sSQL  = "SELECT * FROM Tusers WHERE Tusers.userId = '" & userId &
"'"     '* Select one specific user record maching userId

        Dim rs As New ADODB.Recordset
        rs.Open sSQL, conn, adOpenStatic, adLockReadOnly     '*the SQL is
passed to the Open method, Open executes and either returns 1 or 0

        If rs.RecordCount <= 0 Then Exit Function        '*if you don't exit
at this point you have a valid connection and a valid username
        If password <> rs!password Then Exit Function     '*compare the
password of the current user to the value stored in the recordset
        CheckLogin = True                                            '* if
you match you are in
End Function

I should point out that I found this code in a book called "Visual Basic 6.0
from Scratch" and I have adapted it to my needs. It does the job
beautifully.


Quote:
> Can I use multiple parameters in the select statement to match username
and
> password values in the database. I can only get it to match on one field
> then try to use the field in the recordset to match the other.



> > I kow this is probably an oversight somewhere on my part but I am having
a
> > problem trying to validate both the password and username through the
ADO.
> > Can someone help me out.

> > Thanks



Wed, 15 Oct 2003 09:20:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to download via login/password a binary using winsock and HTTP

2. How to get Login Password via API

3. How to get Login Password via API

4. Need help: login information via ADO

5. Changing password in Oracle using PASSWORD command via VB app

6. Changing password in Oracle using PASSWORD command via VB app

7. Validate SQL Server login

8. Validate a login

9. Validating login on sql server

10. Create Password Form w/ Validate Module

11. Validate a users password

12. Validating Windows User/Password from Web From

 

 
Powered by phpBB® Forum Software