Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password verification from VB6 to a SQL table

Status
Not open for further replies.

Viguela

Programmer
Mar 26, 2001
3
0
0
US
I have a form where user need to input "EmployeeID" and "Password". At submit button click EmployeeID and Password need to be verify if they are correct on a SQL table.
I need HELP! ASAP!. Thanks.
 
You need to run a SELECT statement against the employee table with the ID and password they entered as parameters. Something like:
[tt]
"SELECT COUNT(*) as Valid FROM tblEmployee " & _
"WHERE ID = " & lEmpID & " AND " & _
"PASSWORD = '" & sPassword & "' "
[/tt]
The result of this will be a recordset with one column named Valid. If Valid contains a 0, then either the ID or password was incorrect and they need to try again. If Valid is 1, then what they entered was correct. If Valid > 1, then you've got a duplicate record in the database (oops!).

One advantage of using the COUNT function this way is that the real password (stored in the database) is never transmitted across the network, keeping it a little more secure.

Chip H.
 
First of all, excuse me my bad english
you can execute
"SELECT Login FROM User WHERE Login = '" & sLogin &
"' AND Passwd = '" & sPasswd & "'"

but I always prefer to encrypt the password first, and save the encrypted password in the database, so when somebody wants to log on your system, the application sent the login and the password but encrypted.

Gonzalo S, from BOLIVIA
 
Thanks for the post Gonzalo.

Yes, having the ASP page (or whatever) encrypt the password first is a good idea. It depends on how much security Viguela needs in the application.

Chip H.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top