Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 June 1st, 2006, 02:59 AM
Authorized User
 
Join Date: May 2006
Location: hubli, karnataka, India.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL select statement problem

i have written the code like this fro sql execute statement;

set rs = conn.Execute("SELECT * FROM estaterec WHERE country=" & country & " AND state= "& sstate &" AND city= "& city &" AND zip=" & zip &" AND propertytype="& ptype &" AND intetion=" & intetion & " AND price=">"' & pmin &'" AND price="<'"& pmax &"')

all variables get the values form the Request.form object.. from a .htm file..

when i preview this page i m getting the following messange;
Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/test/infoseek/realestateshow.asp, line 26, column 251
set rs = conn.Execute("SELECT * FROM estaterec WHERE country=" & country & " AND state= "& sstate &" AND city= "& city &" AND zip=" & zip &" AND propertytype="& ptype &" AND intetion=" & intetion & " AND price=">"' & pmin &'" AND price="<'"& pmax &"')
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

can any one get this problem and solve for me... please it is very urgent project... please help me.....

shri
__________________
shri
Reply With Quote
  #2 (permalink)  
Old June 1st, 2006, 03:43 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi shri

If you are adding double quotes to a string in VB you need to add two double quotes e.g.
Code:
... AND price="">""" & ...
But a little confused by the =">" part of you statement, I think it should be...
Code:
set rs = conn.Execute("SELECT * FROM estaterec WHERE country=" & country & " AND state= " & sstate & " AND city= " & city & " AND zip=" & zip & " AND propertytype=" & ptype & " AND intetion=" & intetion & " AND price >= " & pmin & " AND price <= " & pmax & ";")
You may also need to add quotes around some of your field values if they contain strings e.g.
Code:
... AND zip='" & zip & "' AND ...
HTH,

Chris

Reply With Quote
  #3 (permalink)  
Old June 1st, 2006, 05:20 AM
Authorized User
 
Join Date: May 2006
Location: hubli, karnataka, India.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this code has been worked......

but the problem is that.. it is displaying all the records in the DB....it should display the records filtered by the given sql statement conditions; any how here is my code....;

set rs = conn.Execute("SELECT * FROM estaterec WHERE country='" & country & "' AND state= '" & sstate & "' AND city= '" & city & "' AND zip=" & zip & " AND propertytype='" & ptype & "' AND intetion='" & intetion & "' AND price >= " & pmin & " ;")


please .. solve this ....

shri
Reply With Quote
  #4 (permalink)  
Old June 15th, 2006, 10:28 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you find your problem? The statement you provided should work as far as I can see.

Woody Z http://www.learntoprogramnow.com
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
Construct a SQL Select Statement ricespn Beginning VB 6 1 May 28th, 2007 07:57 AM
Problem with SELECT INTO statement 132591 SQL Language 1 November 27th, 2006 06:58 AM
YYYY and MM in access' SQL select statement Condor76 Access VBA 1 February 15th, 2006 02:47 PM
help needed with a SQL select statement problem wslyhbb Java Databases 1 August 14th, 2003 07:30 AM
ASP sql select statement scorpio Classic ASP Databases 5 July 30th, 2003 06:48 AM



All times are GMT -4. The time now is 12:59 AM.


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