From: jedale on
I would put the comma before the and statement that way you don't have to worry
about the last comma at the end of the list. That should take care of your
problem except for the first argument that doesn't need a comma. I would hard
code a bogus column in order to get the ball rolling so that you could use a
comma at the start of your structure loop. Hope this helps.

Jeff

From: BKBK on
an idea



<cfquery>
UPDATE MyTable SET
<cfloop collection="#Arguments.FormStruct#" item="field">
<cfset Counter = Counter + 1 />
<cfif field NEQ "FieldNames" AND field NEQ "MyID">
<cfif Counter NEQ structCount(Arguments.FormStruct)-2>
#field# = '#Arg[field]#',
<cfelse>
#field# = '#Arg[field]#'
</cfif>
</cfif>
</cfloop>
WHERE MyID = #Arg.MyID#
</cfquery>

From: murpg on
BKBK, thanks that was a petty good insight for dealing with the comma. I am
going to throw out another thought. I am also going to have to deal with the
proper syntax depending on the data type of the columns I am updating. Any
thoughts on how I get those. I was thinking that perhaps I could find this out
by using a query like this and appending the data type to the form structure
and then start the first function.

<cfquery name="Recordset2" datasource="#application.ds#">
Select COLUMN_NAME, DATA_TYPE
From #application.ds#.INFORMATION_SCHEMA.Columns
Where TABLE_NAME = '#form.tablename#'
</cfquery>