Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2004, 03:18 PM
Authorized User
 
Join Date: Jun 2003
Location: San Jose, CA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Request("var") issue

Hello,

My issue is that I am trying to pass a Query String to an ASP script that then searches for that variable in an SQL database. The script works fine until I subject it to my lack of ASP knowledge. Here's the details:


file call:
Code:
clientlist_alph.asp?alph=a
Script Line:
Code:
var oRs = theDatabase.execute("SELECT * FROM COMPANY WHERE
COMPANY_IMAGEFOLDER LIKE '"& Request("alph") &"%' ORDER BY
COMPANY_IMAGEFOLDER");
I get this error:
Code:
POST /control/clientlist_alph.asp |22|80040e14|[Microsoft]
ODBC_SQL_Server_Driver][SQL_Server]Line_1:_Incorrect_syntax_near_'0'.
500
However it works fine when I run it without that piece:
Code:
var oRs = theDatabase.execute("SELECT * FROM COMPANY ORDER BY 
COMPANY_IMAGEFOLDER");
Got any ideas what I'm doing wrong? Any help would be appreciated.

----------
~cmiller
__________________
----------
~cmiller
 
Old May 21st, 2004, 10:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have you defined the CONNECTION object and RECORDSET objects? Can you post that code too?

AFAIK, var is not a Keyword used to define a variable in ASP. Are you doing that using Javascript/jscript?

var oRs=.....

Regarding Request("alph")...

Please use
Code:
Response.write Request("alph")
to see if that prints the value as "a" when your querystring values is passed as "a"

I would suggest you to better use Request.QueryString("alph") instead of Request("alph").

If that prints the value as "a", then do a response.write for the sql statement.

Response.Write "SELECT * FROM COMPANY WHERE
COMPANY_IMAGEFOLDER LIKE '"& Request("alph") &"%' ORDER BY
COMPANY_IMAGEFOLDER"
Response.End 'To terminated the page being processed by IIS at this level, use

Copy Paste this in your Query window to see if that returns the expected result.

Let us know if you find any thing wierd.
Hope that helps.
Cheers!

-Vijay G




Similar Threads
Thread Thread Starter Forum Replies Last Post
request forwarging & request redirection hafizmuhammadmushtaq Servlets 2 April 24th, 2008 12:42 AM
Request.Form / Request.QueryString Toran Classic ASP Databases 4 January 17th, 2007 02:23 PM
Using a var into the name of another var or field. guizero Access VBA 3 May 30th, 2006 03:47 PM
request.qurystring vs. request.form Durwood Edwards Classic ASP Databases 3 June 18th, 2004 12:09 AM
request.querystring() , request.form() alyeng2000 ASP.NET 1.0 and 1.1 Basics 1 December 30th, 2003 12:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.