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!

jscript conditonal upon data retrieval from DB 1

Status
Not open for further replies.

robertl

Programmer
Jan 8, 2001
23
GB
I have the following snippet of code in an ASP page:

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 User_Name, Password FROM mainpwl&quot;
	RS = CON.execute(SQL)
	IF RS(&quot;Password&quot;) = upass AND RS(&quot;User_Name&quot;) = uname THEN
		Response.Redirect &quot;granted.htm&quot;
	ELSE

I'm wanting to compare the recordset password and user name
to those entered by the user on a previous page (thus the
request.form). However, with this code as seen above I receive an error that a &quot;;&quot; is required. I already had this working in VBScript, but with a tip I received yesterday with another problem, I had to change my server side scripting over to javascript in order to dynamically view the files within a folder.

Thanks in advance.
 
IF(RS(&quot;Password&quot;) == upass AND RS(&quot;User_Name&quot;) == uname)
{
Response.Redirect &quot;granted.htm&quot;
}
ELSE
adam@aauser.com
 
Thanks, different from what I tried this morning but now
theres a &quot;)&quot; expected message pointing around the AND condition.

I know I must be close to getting this working.

 
IF((RS(&quot;Password&quot;) == upass) &amp;&amp; (RS(&quot;User_Name&quot;) == uname))



sorry. adam@aauser.com
 
Thanks, it appears that might work. I received an error
of &quot;Object expected&quot; so I included the statement

Code:
<%Response.Buffer = True%>

but that just creates another error in that &quot;True&quot; is not defined. I've read conflicting statements on different sites that Response.Redirect should not be used and that
people have used document.location instead should I be looking at different syntax in place of the response.redirect?

Thanks for your help.
 
well, response.redirect cannot be used after content has been written to the client.

and i think you might want to use Response.Buffer = true;

i think True and true are 2 different things. adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top