We help IT Professionals succeed at work.
Get Started

populating insert query with data from 2D array in Coldfusion

727 Views
Last Modified: 2013-12-24
Hi All,

I'm trying to insert the contents of a 2D array into a database. I'm having a hell of a time getting it to work. Below is what I've tried, but it gives an error (The value coldfusion.runtime.Array cannot be converted to a number.). What should I be doing?

<cfloop array="#measureValues#" index="i" >
        <cfquery name="updateAss_DRDP_line" datasource="#application.dsn#" username="#application.username#" password="#application.password#" > 
INSERT INTO CDP_Ass_DRDP_line ( AssessmentID, MeasureID , Value1, Value2, Value3, Value4, Value5, Value6, UnableToRate,  ) VALUES ( <cfqueryparam cfsqltype="cf_sql_int" value="#attributes.AssessmentID#" /> , 
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][8]#" /> , 
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][1]#" /> , 
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][2]#" /> ,
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][3]#" /> ,
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][4]#" /> ,
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][5]#" /> ,
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][6]#" /> ,
<cfqueryparam cfsqltype="cf_sql_integer" value="#measureValues[i][7]#" /> ) 
</cfquery>
      </cfloop>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE