Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.