Thanks,
It worked great!!
-----Original Message-----
From: Rick Osborne [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 11, 2000 5:25 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: cf query
This is due to the extreme strangeness that governs how CF escapes single
quotes. You will probably need to use PreserveSingleQuotes(), just be aware
that it will leave escaping the individual parts of the clause up to you.
For example:
<CFPARAM NAME="Form.Names" DEFAULT="">
<CFLOOP LIST="#Form.Names#" INDEX="Name">
<CFSET Name=Replace(Name,"'","''","ALL")>
<CFSET Clause=ListAppend(Clause,"(Name = '#Name#')"," OR ")>
</CFLOOP>
<CFQUERY NAME="GetPeople" DATASOURCE="dsn">
SELECT PersonID, Name
FROM People
WHERE #PreserveSingleQuotes(Clause)#
</CFQUERY>
See what I mean?
-Rick
-----Original Message-----
From: Leroy, Eric [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 11, 2000 5:09 PM
To: '[EMAIL PROTECTED]'
Subject: cf query
I am having trouble using a variable with single quotes in it in a cfquery
<CFSET t2="test">
<CFQUERY NAME="GetLastest" DATASOURCE="Info">
select * from tblmessages where subject = ' #t2# '
</cfquery>
works fine.
However, I need to send a variable with an entire where clause such as:
<CFSET t2="subject like 'test' ">
<CFQUERY NAME="GetLastest" DATASOURCE="Info">
select * from tblmessages where #t2#
</cfquery>
Which returns an error (even though the query statement is the exact same
when it is printed out)
This should be easy but I can't figure it out.
Any help would be greatly appreciated.
Thank you,
Eric J. LeRoy
RST Database Admin/Software Developer
(716) 422-4682
[EMAIL PROTECTED]
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.