Hello everyone.
I am relatively new to CF but not new to development. I am working on a
small project that requires processing form inputs for insertion into an
Access 2007 db. The version of CF I am on is CF MX-7.0.2. On one form
there are two list boxes that allow multiple selections and that's where
I am getting my problem. The multiselect list boxes need to be inserted
into a linking table and the values that need to be inserted are the
selections themselves plus the other foreign key required to maintain
integrity. To get this number (Student_ID) I have a small function that
grabs the last value put into the Student_ID PK field.
That number is paired with the multiple selection in an insertion loop
and put into the db.All of this works perfectly except it doesn't... and
it's driving me crazy.
Here's one of the literally hundreds of variations I have tried. The
error is always on the same line:
<cfset var lastID="#getLastID()#">
<cfloop index="i" list="#form.mnuInsStatus#" delimiters=",">
<cfdump var="#i#">
<cfdump var="#lastID#">
<cfquery name="newstatus" datasource="#request.eltcdata#">
insert into Student_Status (Student_ID,Status_ID)
values (<cfqueryparam value="#lastID#" cfsqltype="cf_sql_clob">,
<cfqueryparam value="#i#" cfsqltype="cf_sql_char">)
</cfquery>
</cfloop>
The thing is, those dumps there have EXACTLY the right values. The CF
debug shows that all of the multiple selections are making it into
the function and the PK is correct.
1 //the "i" value
query - Top 1 of 1 Rows
EXPR1
1 104
//the PK
MNUINSSTATUS=1,2,3,4,5
As you can see the value is a simple int - nothing tricky. A meta dump
from that Access table indicates that
the value CF want s there is type INT but I have tried all or nearly all
of the cf-sql types.
I have also tried not using the CFqueryparam thing at all but that
doesn't work. As I have said I have tried
hundreds of variations and I am at my wit's end. I really hope someone
can help me out here as I am sort of stalled
until I get this figured out and there are multiple selections involved
in this project.
Thanks,
Paul
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301506
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4