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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Compare/database record problem.. 1

Status
Not open for further replies.

mackey333

Technical User
May 10, 2001
563
US
Hey everyone...I am having a little trouble with a logon script. I am trying to check the password against the one from the database and I cannot get the strings to compare correctly.

I have:

p = ObjRS.Fields("pw") 'password from the database
pass = Request.queryString("password") 'password from the form

I printed out both the values (Response.Write) and they both are correct (the password is 'test') however when I try and do:

if p = pass then...

it returns false. Also, StrComp(p, pass) returns a value of 1. I don't understand why it isn't working especially since with I print out the values they are both the same/correct. Any ideas?



-Greg :-Q

flaga.gif
 
It might be the way you store your password, did you use char (or fixed length string fields) instead of varchar?
If so you'll have some spaces at the end of your test word

try to use trim function to get rid of the spaces.
Code:
p = trim(ObjRS.Fields("pw")) 'password from the database
pass = Request.queryString("password") 'password from the form

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Try

p = objRS.Fields("pw").value


If I may add something, you should not pass a password using a GET method.

Just precaution...



QatQat

Life is what happens when you are making other plans.
 
Thanks guys...the trim method took care of it. As for the get method, I had changed it to aid in debugging.

-Greg :-Q

flaga.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top