if you're using SQL Server, your variable can have 's in it and you don't
need to use PreserveSingleQuotes().

can you post the code that doesn't work?

-----Original Message-----
From: John Stanley [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 6:58 AM
To: CF-Talk
Subject: RE: Escaping apostrophes


Just thoughts:

        1. Search the string before add/update the query and replace the
single quote with a never used character like the pipe "|", then when the
data needs to be rendered on the browser, just search it before display and
replace the pipe with the single quote.
        2. Search the string before add/update the query and replace the
single quote with a "chr(39)" this literally should replace all single
quotes with the actual string chr(39), search the string for chr(39) on
output and put pound signs aound it.

        It seems to me I have tried using the PreserveSingleQuotes function
with no success.

-----Original Message-----
From: Bryan LaPlante [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 9:49 AM
To: CF-Talk
Subject: Re: Escaping apostrophes


try the #preservesinglequotes(text)# function

----- Original Message -----
From: "andrew kopelman" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, March 26, 2001 2:38 PM
Subject: Escaping apostrophes


> Hello,
>
> This must be a basic question, but I found no real answer on the allaire
> forums.
>
> I want to allow users to enter apostrophes in text, which I then save to
the
> database.  However, the sql insert will fail as it interprets this
> apostrophe within the text as one of the apostrophes surrounding the text.
>
> Example:
>
> INSERT INTO tblUserComments (userid, usercomment)
> VALUES (12345, 'I don't know what to think')
>
> This fails on the ' in don't
>
> There must be a better solution than HTMLEditFormat.
>
> Thanks in advance.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to