Ok Preservesinglequotes() didn't work. Got an error saying "invalid construct 
'[' at.."
All I did was to replace '#form[fn & "_" ocid]#' with 
'#preservesinglequotes(form[fn & "_" ocid])#'.

Then I tried cfqueryparam, got a 'could not prepare statement' error. But that 
could be because of the weird way the query is formed. Will anyone plz make 
comments on this query ?


<cfquery datasource="#DSN1#" name="AddcontractInfo" >
        insert into tblccontractinfo 
        (contract_id,oc_id,#fldnames#)
        <cfset counter = 0>
        <cfloop list = "#form.ocids#" index="ocid">
        <cfset counter = counter + 1>
        <cfif counter gt 1> UNION ALL </cfif>
        select #getkey.mkey#, #ocid# <cfloop list="#fldnames#" index="fn"><cfif 
fn neq "pde">#val(form[fn & "_" & ocid])#<cfelse>,<cfqueryparam value="#form[fn 
& '_' & ocid]#" cfsqltype="cf_sql_longvarchar"></cfif></cfloop>
        </cfloop>
</cfquery>      

What I am doing is, I am using a single insert query instead of multiple 
inserts, by doing a insert into select,
where my select is actually a 'union all' of multiple selects (based on the 
form input).

THE QUERY WORKS when I just use '#form[fn & "_" & ocid]#' instead of 
cfqueryparam or preservesinglequotes. But the only issue is, when I have say 
ten singlequotes one after the other in my form field, I see only five in the 
db after the insert.

What should I do ??




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315963
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to