Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another easy one... I guess for you guys... 1

Status
Not open for further replies.

Ayac

Programmer
Nov 10, 2000
141
HU
Hi All,

It is probably a very dummy question, but I just started Cold Fusion, anyways, so how come this:

<cfset strQuery = "SELECT * FROM members WHERE FIRST_NAME LIKE 'Smith%' AND LICENSE_STATUS IS NOT NULL ORDER BY SORT_FIELD">
<CFQUERY NAME="SearchList" DATASOURCE="iMIS_Members">
#strQuery#
</CFQUERY>

does not work, but this does:

<CFQUERY NAME="SearchList" DATASOURCE="iMIS_Members">
SELECT * FROM members WHERE FIRST_NAME LIKE 'Smith%' AND LICENSE_STATUS IS NOT NULL ORDER BY SORT_FIELD
</CFQUERY>

The first one gives me an ODBC error, however it looks identical to me to the other.

Any ideas?
 
<CFQUERY NAME="SearchList" DATASOURCE="iMIS_Members">
#preservesinglequotes(strQuery)#
</CFQUERY>

Preservesinglequotes is the function you want for that


ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top