On 26 Mar 2001, at 17:20, Philip Arnold - ASP wrote:
> OK, here's how it works - you use PreserveSingleQuotes() to keep
> apostrophies if you're building the SQL in a string before you
> pass it to CFQuery
>
> If you want to put an apostrophie into a field, then you must
> double it; Replace(myField,"'","''","all")
Just to clarify: None of this applies if you're just
interpolating variable values into your CFQUERY rather than
building the SQL in a string beforehand -- something like this:
<CFQUERY DATASOURCE="#DSN#" NAME="Bios">
SELECT ID, FirstName, LastName, Bio
FROM Persons
WHERE LastName = '#SearchName#'
</CFQUERY>
In that case, CF automagically doubles your single quotes on
its own (unless you use PreserveSingleQuotes()), and you don't
have to worry about doing anything special to handle people
named "O'Neill".
Keith C. Ivey <[EMAIL PROTECTED]>
Webmaster, EEI Communications
66 Canal Center Plaza, Suite 200
Alexandria, VA 22314
Telephone: 703-683-0683
Fax: 703-683-4915
Web Site: http://www.eeicommunications.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists