Question
What is wrong with this code - will not update
I am attempting to use the following code to update a column
in a table :
<cfloop from="1" to="#form.totalRows#" index="row">
<cfparam name="form.PartNumberID#row#">
<cfparam name="form.deliveryNumber#row#">
<cfset PartNumberID = form["PartNumberID"& row]>
<cfset deliveryNumber = form["deliveryNumber"& row]>
<cfquery name="qryUpdate" datasource="datasource">
update TABLE
set deliveryNumber = '#deliveryNumber#'
where (Rdn = #Rdn# and PartNumberID = #PartNumberID#)
</cfquery>
</cfloop>
It appears to execute successfully without any errors. Yet when I check the sql server, the deliveryNumber column in the table is still NULL and not updated with the valued entered in the form/screen.
I have used <cfoutput> to display all the values and they all come out as they should be (I selected one record to test and the variables displayed from cfoutput all correspond to the record)
I even took the update part and ran it thru the query analyzer and plugged in/hardcoded the values from the variables and the update works, the deliveryNumber column in the table is updated. So it appears the code is working.
Yet when I run it thru the application, it does not work and does not give any errors.
Can somebody tell me what the problem is, I just cannot see it ?
Thanks
<cfloop from="1" to="#form.totalRows#" index="row">
<cfparam name="form.PartNumberID#row#">
<cfparam name="form.deliveryNumber#row#">
<cfset PartNumberID = form["PartNumberID"& row]>
<cfset deliveryNumber = form["deliveryNumber"& row]>
<cfquery name="qryUpdate" datasource="datasource">
update TABLE
set deliveryNumber = '#deliveryNumber#'
where (Rdn = #Rdn# and PartNumberID = #PartNumberID#)
</cfquery>
</cfloop>
It appears to execute successfully without any errors. Yet when I check the sql server, the deliveryNumber column in the table is still NULL and not updated with the valued entered in the form/screen.
I have used <cfoutput> to display all the values and they all come out as they should be (I selected one record to test and the variables displayed from cfoutput all correspond to the record)
I even took the update part and ran it thru the query analyzer and plugged in/hardcoded the values from the variables and the update works, the deliveryNumber column in the table is updated. So it appears the code is working.
Yet when I run it thru the application, it does not work and does not give any errors.
Can somebody tell me what the problem is, I just cannot see it ?
Thanks
