macromedia.coldfusion.database_access
[Top] [All Lists]

Re: MS SQL - Syntax error for valid query

Subject: Re: MS SQL - Syntax error for valid query
From: Ian Skinner <iskinner@xxxxxxxxxxx>
Date: Tue, 29 Jan 2008 11:45:13 -0800
Newsgroups: macromedia.coldfusion.database_access


AWFrueh1808 wrote:
I guess I'm thick today.

What confuses me is that the error code SHOWS the single quote. And if I CFOUTPUT my variable, it also still shows the quote. I don't understand why I can CFOUTPUT the variable and see the single quotes just fine - it's not been escaped from what I can tell - the variable just doesn't work in a CFQUERY. That's what really threw me.


If you output the variable it will only have the single quotes in it. The variable value is not modified. The extra single quotes are not added until the variable is parsed as SQL code inside a <cfquery...> block.

If you look at the generated SQL code with either the debugging output or the newer 'result' parameter of the <cfquery...> tag you will see the escaped quotes in it. Presuming you are not implementing the preserveSingleQuotes() function at the time.


<Prev in Thread] Current Thread [Next in Thread>