Hi there,
I´ve got a problem with the cfqueryparam-tag.

I create a string with a sql-statement within a cfscript-block. After that I
create an object and call the function to run the query. That looks like
this:
-------------------------------------------------------------------
<cfscript>
....
my_sql = "select  #application.Prod["txt"]#                     PROD_TXT
                from    #application.Tables["prod"]#                    
                Join    #application.Tables["subs_pgrp"]#       on
(#application.SubsPgrp["oid"]# = #application.Prod["subs_pgrp_oid"]#)
                Join    #application.Tables["prod_grp"]#                on
(#application.ProdGrp["oid"]# = #application.SubsPgrp["pgrp_oid"]#)
                Join    #application.Tables["prod_grp_name"]#   on
(#application.ProdGrpName["poid"]# = #application.ProdGrp["oid"]#)
                Join    #application.Tables["dept"]#            on
(#application.Dept["oid"]# = #application.ProdGrp["dept_oid"]#)
                Join    #application.Tables["dept_name"]#       on
(#application.DeptName["poid"]# = #application.Dept["oid"]#)
        where   #application.Prod["oid"]#                       =
[CHAR]##EbDspData1[data_key_1].SUBSID_PROD_OID##[/CHAR]
                AND     #application.ProdGrpName["cabbr"]#      =
[CHAR]##session.app_language_iso##[/CHAR]
                AND     #application.DeptName["cabbr"]#         =
[CHAR]##session.app_language_iso##[/CHAR]";
....
objSql  = createObject("component", "common.util.Database");
get_data = objSql.runPreparedQuery(my_sql);
....
<cfscript>
-------------------------------------------------------------------

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:236335
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

Reply via email to