Thanks all Steve's preservesinglequotes saved the day.

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

Are you using the preservesinglequotes function like this:

<cfquery name="getsearchresult1" datasource="#config.datasource#">
SELECT property_id from property_details where
#preservesinglequotes(featurestr)#
</cfquery>

steve

-----Original Message-----
From: Pragnesh [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 25 June 2003 11:15 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Cant work out SQL Query error.


Still doesnt work.
Am generating the where clause dynamically

featurestr="";
for (i = 1; i LTE listlen(form.features); i = i+1) {

fid=ListGetAt(form.features,i,",");

featurestr=featurestr & "property_features = '" & fid & "'";
featurestr=featurestr & " OR property_features LIKE '%," & fid & "'";
featurestr=featurestr & " OR property_features LIKE '" & fid & ",%'";
featurestr=featurestr & " OR property_features LIKE  '%," & fid & ",%'";


Am getting this as the output:
property_features = '1' OR property_features LIKE '%,1' OR
property_features
LIKE '1,%' OR property_features LIKE '%,1,%' OR property_features = '2'
OR
property_features LIKE '%,2' OR property_features LIKE '2,%' OR
property_features LIKE '%,2,%'

When I use it in a query, it throws an error

<cfquery name="getsearchresult1" datasource="#config.datasource#">
SELECT property_id from property_details where #featurestr#
</cfquery>

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

Single quotes instead of double, but also:

Change OR property_features LIKE "2"
To: OR property_features = '2'

Steve c

-----Original Message-----
From: Pragnesh [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 25 June 2003 10:52 AM
To: CFAussie Mailing List
Subject: [cfaussie] Cant work out SQL Query error.


HI All,

Cannot work out why the sql query is throwing an error. Worst thing is
when
I execute the query in MS ACCESS it runs but thro CF it throws this
error.
Any suggestions would be appreciated.

Error:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
8.
Hint: The cause of this error is usually that your query contains a
reference to a field which does not exist. You should verify that the
fields
included in your query exist and that you have specified their names
correctly.

SQL Query is:
SELECT property_id from property_details where property_features LIKE
"1" OR
property_features LIKE "%,1" OR property_features LIKE "1,%" OR
property_features LIKE "%,1,%" OR property_features LIKE "2" OR
property_features LIKE "%,2" OR property_features LIKE "2,%" OR
property_features LIKE "%,2,%"



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/





---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/





---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to