Well thats your problem right there
Trying to insert a complex var into a query like that will not escape the
single quotes
what you could do it something like this
<cfscript>
for (key in session.SPrinterRegistration)
{"#key#" = session.SPrinterRegistration[key];}
</cfscript>
then just reference local variables in your query like '#ContactCompany#'
instead of using the structFind function
Steve
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Jason Bayly
Sent: Thursday, January 22, 2004 10:38 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: CFMX not escaping single quotes
Hi Steve,
The query is massive so no point copying it all here... but its a simple
form var to structure over a multipage process with the final insert
occuring that causes the error. I didnt write this code but inherited it
with my current job..
For some reason the developer on the insert uses
'#StructFind(session.SPrinterRegistration, "ContactCompany")#', to get the
value out of the structure instead of simply
'#session.SPrinterRegistration.ContactCompany#' ... would rewriting the
query thus solve the problem ? Is this considered a simple var still ?
Jason
"Steve Onnis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>
> Jason
>
> Coldfusion will escape the singlequotes on its own, but only is the
variable
> being used is a somple variable.
>
> A simple variable is what you get when you do something like <cfset myVar
=
> "St Ursula's College">.
>
> But is you had something like
>
> <cfset myVar = ArrayNew(1)>
> <cfset myVar[1] = "St Ursula's College">
>
> I believe that it wont escape the singlequotes
>
> Can we have alook at your full query and where your getting the variables
> from?
>
> Regards
> Steve
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Jason Bayly
> Sent: Thursday, January 22, 2004 9:53 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] CFMX not escaping single quotes
>
>
> Hi all
>
> I'm getting repeated syntax errors on an insert statement that has to do
> with a single quote appearing in a string. In the past ive never had to
> worry about single quotes in a string cause i thought CF automatically
> escaped them in a query. Am i incorrect here ?
>
> heres part of the debug msg... any one got a good method to ensure this
> doesnt happen ??
>
> ODBC Error Code = 37000 (Syntax error or access violation)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 161: Incorrect syntax
> near 's'.
>
> VALUES ( '38 Taylor Street', '', 'Toowoomba', 'St Ursula's College',
>
>
>
> cheers
> jason
>
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
>
>
>
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004