>From the CF4.5 Language Reference -
PreserveSingleQuotes -
Prevents ColdFusion from automatically "escaping" single
quotes contained in variable.
What is going on is I have a CFGRID that I have to manually update
because it throws an error if I use CFGRIDUPDATE. My own code which
does the update and insert works perfect except when it encounters the
string "Teacher's". For some reason that I don't know, the single
quote does not get escaped when I pull it from the variable
FORM.EDITTABLE.SIZE[i]. I can't figure out what to do. I want the
single quote to be escaped so that it will insert into the database
without error. I've already tried the function
#Replace(FORM.EDITTABLE.SIZE[i], "'", "''", "all")# but it doesn't work
for me. Anybody got any ideas what's going on?
Thanks,
- Matt Small
-----Original Message-----
From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 12:49 PM
To: CF-Talk
Subject: RE: Crosspost: Escaping single quotes
I am either confused about the functionality you want, or the
functionality PreserveSingleQuotes provides.
PreserveSingleQuotes preserves single quotes for database inserts by
automatically escaping them. It needs a variable as the value, not a
string. I'm assuming you already have "Teacher's Group" in a variable?
<cfoutput>
<cfset temp = "Teacher's Group">
#PreserveSingleQuotes(temp)#
</cfoutput>
You could probably try to do something more using replace:
#Replace("Teacher's Group", "'", "''", "all")#
will return:
Teacher''s Group
At 11:55 AM 4/12/2002 -0400, you wrote:
>No, that preserves single quotes. I want to escape single quotes.
>
>Thanks,
>Matt Small
>
>-----Original Message-----
>From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 12, 2002 11:32 AM
>To: CF-Talk
>Subject: Re: Crosspost: Escaping single quotes
>
> Isn't there a function (PreserveSingleQuotes) that does this?
>
>At 11:38 AM 4/12/2002 -0400, you wrote:
> >Hi everybody,
> > I'm having a problem with an update to a table - the problem
>is
> >when I want to update or insert the string "Teacher's Group". CF
>throws
> >an error at me when I try this. I know that CF usually escapes the
> >single quote, but it's not in this case. I know I saw a post with on
> >this list or CFDJList about there being a bug with escaping single
> >quotes
> >in CF4.5. Anybody know how can I make CF escape the single quote for
> >insertion into my table? Thanks
> >
> >Matt Small
> >
> >
> >
> >
> >
>
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists