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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com 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

