Print Page | Close Window

Need help with error message...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=28585
Printed Date: 28 March 2026 at 10:56am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Need help with error message...
Posted By: brossyg
Subject: Need help with error message...
Date Posted: 12 May 2010 at 6:44pm
I am trying to match a string on the server side of an ASP page. My code is this:

Code:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!-- #include file = "connection.asp" -->
<!-- #include file = "replace.asp" -->

<%
var r_user;
var r_pass;

r_user = Request.querystring("xyz");
r_pass = Request.querystring("abc");

r_user = replaceAwithBinC("'","'",r_user + '');
r_pass = replaceAwithBinC("'","'",r_pass + '');

r_user = replaceAwithBinC('"',""",r_user + '');
r_pass = replaceAwithBinC('"',""",r_pass + '');

var quer = "SELECT access_code FROM resourceadmin WHERE (user_name = '" + r_user + "') AND (user_pass = '" + r_pass + "')";
var rs = Server.CreateObject("ADODB.RecordSet");
rs.Open(quer,con);	

var access = rs("access_code");
Response.Write(access);

if(access.indexOf("wc")<0) {
	Response.Write("Yes");
}
else{
	Response.Write("No");
}

rs.Close();
rs = null;

con.Close();
con = null;
%>
This gets a Username and Password from a URL link, gets the "access_code" from the Access database for that subscriber and then I am trying to match the access code for the letters "wc".

It works fine until it tries to match the string "wc" to the access code. The variable "access" properly appears as 999, so the match should return "No".

However, I get an "Object doesn't support this property or method" error for the line that has the if(access.indexOf("wc")<0) statement on it. I have tried using InStr(), but that doesn't work either.

Please help! I don't know why I am getting this error. Thanks.



Replies:
Posted By: gotlivechat
Date Posted: 04 August 2010 at 3:40am
Seems you're mixing javascript with asp.  The test for string comparison is INSTR; so
IF INSTR(access,"wc")>0 THEN do something
If that doesn't work, do a response.write on access to see what value it is.


-------------
Adam Rasio
Live Chat Software Developer

http://www.GotLiveChat.com" rel="nofollow - www.GotLiveChat.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net