Rats.. that won't work.. so much for code humor.
Good Fortune,
Richard Walters,
Webmaster, Davita Laboratory Services
[EMAIL PROTECTED]
(800) 604-5227 x 3525
>>> [EMAIL PROTECTED] 04/12/02 03:53PM >>>
<cfset theVariable = #evaluate(chr(39) & "Smith's shorts" & chr(39))#>
<cfquery name="queryit" datasource="#dsn#">
update items
set itemname =
#preservesinglequotes(htmleditformat(theVariable))#
</cfquery>
How's that for an explanation? It must be Friday!
Good Fortune,
Richard Walters,
Webmaster, Davita Laboratory Services
[EMAIL PROTECTED]
(800) 604-5227 x 3525
>>> [EMAIL PROTECTED] 04/12/02 03:36PM >>>
Well, that isn't a database error, at least. It seems to be
spitting
up
on the '[' character. It is a fairly complicated variable structure
(Is it
structures of structures or just variable names with dots in them? )
Maybe you need to play around with pound signs?
'#PreserveSingleQuotes(FORM.EDITTABLE.SIZE["#i#"])#'
I'm stuck and without database / code to attempt to debug against, I
don't think there is much other help I could offer.
Did you try HTMLEditFormat as someone else had suggested?
At 03:27 PM 4/12/2002 -0400, you wrote:
>Well, Jeffrey, I hadn't actually tried the function so I figured I
might
>as well give it a shot. It didn't work.
>
>
>Just in time compilation error
>
>Invalid parser construct found on line 48 at position 55. ColdFusion
was
>looking at the following text:
>
>[
>Invalid expression format. The usual cause is an error in the
expression
>structure.
>
>This is line 48
>
>,SIZE = '#PreserveSingleQuotes(FORM.EDITTABLE.SIZE[i])#'
>
>
>Thanks,
>Matt Small
>
>-----Original Message-----
>From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 12, 2002 2:54 PM
>To: CF-Talk
>Subject: RE: Crosspost: Escaping single quotes
>
> What is the full query?
> I really think that Preserve Single Quotes is supposed to handle
>this. I know you said that it wasn't working, but do you get the
same
>error if you do this:
>
>,SIZE = '#PreserveSingleQuotes(FORM.EDITTABLE.SIZE[i])#'
>
>
>At 01:59 PM 4/12/2002 -0400, you wrote:
> >This is the offending line:
> >,SIZE = '#FORM.EDITTABLE.SIZE[i]#'
> >
> >
> >and the cfoutput of that line:
> >
> >,SIZE = 'Teacher's Solo'
> >
> >
> >
> >Here is the error:
> >
> >ODBC Error Code = 37000 (Syntax error or access violation)
> >
> >
> >[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
> >operator) in query expression ''Teacher's Solo' ,TYPE =
'Competitive'
> >where id = 1'.
> >
> >
> >If I remove the line where Teacher's Solo occurs then it works
great.
> >
> >- Matt Small
> >
> >
> >
> >-----Original Message-----
> >From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, April 12, 2002 1:37 PM
> >To: CF-Talk
> >Subject: RE: Crosspost: Escaping single quotes
> >
> > What error are you getting? What database are you using? Have
you
> >tried
> >outputting the data after you submit it to see what you are
getting?
> >
> >
> >At 01:38 PM 4/12/2002 -0400, you wrote:
> > > >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
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
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