cfquery sql update loop problem
Trying something a bit tricky, need some ideas.
I've got an array of objects that I pass to a cfc from flex, I'm trying to save this array to the database.
Here's what I have that doesn't work.
<cfquery name="setObjDetail" datasource="test">
UPDATE ObjTable
SET
<cfloop index="i" from="1" to="#len(objDetails)#">
#objDetails.Name# = '#objDetails.Value[1]#' ,
</cfloop>
WHERE OBJID = <cfqueryparam value="#objID#" cfsqltype="cf_sql_integer">
</cfquery>
The error I'm getting is
faultCode:Server.Processing faultString:'Unable to invoke CFC - Complex object types cannot be converted to simple values.' faultDetail:'The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values. <p> The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a cfif tag.'
I have the feeling it's due to the equals symbol (and maybe the comma at the end too). I've tried putting cfoutput tags around it, using ToString method... running out of ideas.
Both #objDetails.Name# and #objDetails.Value[1]# evaluate correctly.
Thanks.
