Skip to main content
September 4, 2008
Question

3 cfquery Updates

  • September 4, 2008
  • 1 reply
  • 397 views
I have a template that updates 3 database tables with three different cfquery update statements. For some reason the second 2 are not updating the data specified by the query. Here is a look at the code.

<CFQUERY NAME = "SubJob" datasource="db">
UPDATE SubJob
SET SubJobNumber = '#FORM.SubJobNumber#',
Project = '#FORM.Project#',
PONumber = '#FORM.PONumber#',
OriginalPOAMT = '#FORM.OriginalPOAMT#',
WONumber = '#FORM.WONumber#',
AccountNumber = '#FORM.AccountNumber#',
PreparedBy = '#FORM.PreparedBy#',
ProjectEngineer = '#FORM.ProjectEngineer#'
WHERE SubJobNumber = 'N' AND
JobNumber = '#URL.JobNumber#'
</cfquery>

<CFQUERY DATASOURCE="db" name="SubJob1">
UPDATE Productivity
SET SubJobNumber = '#FORM.SubJobNumber#'
WHERE SubJobNumber = 'N' AND
JobNumber = '#URL.JobNumber#'
</CFQUERY>


<CFQUERY DATASOURCE="db" name="SubJob2">
UPDATE CostJobApproval
SET SubJobNumber = '#FORM.SubJobNumber#'
WHERE SubJobNumber = 'N' AND
JobNumber = '#URL.JobNumber#'
</CFQUERY>

Note: I don't see any errors at all there is simply no updates. Any recomendations.
This topic has been closed for replies.

1 reply

Inspiring
September 5, 2008
When in doubt, look at the data.

Run a select on the record you want to update before and after the update and dump the results.

The presence of both form and url variables looks like a source of trouble.
September 5, 2008
Thanks Dan for your reply. I have found the problem. I had a URL variable that was directing a CFIFand bypassing these queries and running another. Once I moved the queries, they worked. Thanks again.