Wrox Programmer Forums
|
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 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 June 1st, 2006, 02:59 AM
Authorized User
 
Join Date: May 2006
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
 
Old June 1st, 2006, 03:43 AM
Friend of Wrox
 
Join Date: Jul 2003
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

 
Old June 1st, 2006, 05:20 AM
Authorized User
 
Join Date: May 2006
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
 
Old June 15th, 2006, 10:28 AM
Friend of Wrox
 
Join Date: May 2006
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





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





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