Ask a Question related to Coldfusion Database Access, Design and Development.
-
lerxst3 #1
CF double quoting my single quotes in query string
I'm building my query string on the fly. So I have something like this:
<cfset szQuery = "SELECT id FROM tblFoo WHERE id=' " &
#Trim(evaluate(szVarName))# & " ' ">
(I've added a few extra blank spaces to improve readability).
When I do a <cfoutput> of my string, it looks correct. I get:
SELECT id FROM tblFOO WHERE id='5'
However, I get an error running it, and apparently SQL server sees this:
SELECT id FROM tblFOO WHERE id=''5'' (CF adds another single quote - so
it's really two single quotes, not the " character)
Why is CF double quoting my single quote? It's causing me to fail. If I
don't single quote at all, CF doesn't put anything there so my statement simply
becomes: id=5.
lerxst3 Guest
-
Variable double quoting in SQL query when should besingle quote
Hi Anna Try using the PreseveSingleQuotes function. ie. WHERE Town in ('#PreseveSingleQuotes(TownList)#') HTH Zoe -
Single and Double quotes in SQL
On Sat, 20 Sep 2003 21:34:58 +0000, Pablo Fischer wrote: $html_text =~ s/'/''/g; $html_text =~ s/"/""/g; Use the help of regular expressions to... -
Single Quotes vs Double Quotes
With all that's been said in mind ('$var' unparsed "$var" parsed). The rule of thumb I follow is, if it needs to be parsed (has a $variable or \n... -
[PHP] Single Quotes vs Double Quotes
Hi, Tuesday, September 9, 2003, 2:03:34 PM, you wrote: mb> Hi everyone, mb> Could somebody please explain to me the difference mb> between... -
[OT] REXML and double, rather than single quotes
Ian Macdonald <ian@caliban.org> wrote in message news:<20030624010502.GH7020@caliban.org>... If I may digress, I'd like to re-make on observation... -
Dan Bracuk #2
Re: CF double quoting my single quotes in query string
The preservesinglequotes function will help you out. Details are in the cfml
reference manual. If you don't have one, the internet does.
For my curiousity, why is your id field text instead of numeric?
Dan Bracuk Guest



Reply With Quote

