And of course, you shouldn't perform the query without cfqueryparam tags, so in general you should find another way to execute your query. I have a sql abstraction layer in my onTap framework which prepares query syntax in sort of a similar manner that does use cfqueryparam, however, creating that is a _lot_ of work and probably more than you'd want to tackle unless you have a specific need for database agnostic code (in my case I've done a lot of migrating applications away from MS Access to more robust databases, usually SQL Server, so I built it initially largely because I find that migration work dreadful).
> It's not possible to load tags into a variable and then > execute them directly in CF. The entire basis of what your > doing would never work (unless you write the info to file > and cfinclude it but that's a different story for a > different time) > If you were doing a standard query without any CF tags > within the query it would work ok, but those tags kill it. >>In the function I replace the locumtenency by the >>cfqueryparam-tag and run >>the query: >>---------------------------------------------------------- >>--------- >><cffunction name="runPreparedQuery" ...> >><cfscript> >> myNewSql = replace(arguments.mySql, "[CHAR]", >> chr(60)&"cfqueryparam >>value="&chr(34), "All"); >> myNewSql = replace(myNewSql, "[/CHAR]", chr(34)& " >>cfsqltype="&chr(34)&"CF_SQL_VARCHAR"&chr(34)&chr(62), >>"All"); >></cfscript> >><cfquery name="queryResult" datasource="#dbName#" >>username="#dbUser#" >>password="#dbPw#"> >> #myNewSql# >></cfquery> >><cfreturn queryResult /> >></cffunction> >>---------------------------------------------------------- >>--------- >> >>Although the sql-string looks correct if I dump it and it >>works if I copy it >>directly into the cfquery-tag it throws an database-error >>in the way I use >>it. >> >>Any ideas??? >> >> >>I use CF MX7 and a db2-database >> >> >> >>Thanks a lot in advance, >>Sigi > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236349 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54