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

problems with conditional with value from a record set 1

Status
Not open for further replies.

robertl

Programmer
Jan 8, 2001
23
GB
I have the following code where I'm having problems comparing the value that a user entered "upass" with that
retrieved from a database (RS('Password')) (which was assigned to pw for my ease of following).


Code:
<% uname=Request.Form(&quot;uname&quot;) %>
<% upass=Request.Form(&quot;upass&quot;) %>

<%

	CON=Server.CreateObject(&quot;ADODB.Connection&quot;)
	CON.Open(&quot;DSN=verify;&quot;)

	SQL = &quot;SELECT Password FROM mainpwl&quot;
	RS = CON.execute(SQL)
	pw = (RS('Password'))
	if (pw == &quot;upass&quot;)
	{
        	Response.Redirect(&quot;granted.htm&quot;);
	}
	else

When I run this ASP page, I find my problem is lying somewhere with the line
Code:
if (pw == &quot;upass&quot;)
If I omit the quotes the condition does everything after the
Code:
else
if I put in quotes what upass should be (forcing it to be equivalent to pw), then I receive the correct results. If I omit the quotes to have
Code:
if (pw == upass)
then everything after the
Code:
else
is excuted.

What am I doing wrong?

Thanks.
 
try making this:

pw = RS('Password').Value;

and:

if (pw == upass) adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top