cfquery fails with conditional query stored in a variable
Following code doesnt work. Can anyone explain why?
<cfset myquery="select * from employee where id = '10'">
<cfquery name="a" datasource="mydsn">
#myquery#
</cfquery>
Following code doesnt work. Can anyone explain why?
<cfset myquery="select * from employee where id = '10'">
<cfquery name="a" datasource="mydsn">
#myquery#
</cfquery>
What do you mean by "doesn't work"? You really ought to read this before posting: http://forums.adobe.com/thread/607238.
Is the ID really a string-oriented column? I would expect it to be an integer, so it oughtn't have the quotes.
Also, if you are doing what you're doing, if your variable has single quotes in it, you'll need to use preserveSingleQuotes() to stop CF escaping them.
--
Adam
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.