[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

SQL Update Within Loop Not Working

Asked by firstheartland in ColdFusion Studio, Cold Fusion Markup Language, SQL Query Syntax

Tags: Coldfusion, SQL

OK.

I'm trying to loop through a set of results from a database and then apply apply a formula and update the records.  I'm pretty sure that this WAS WORKING before and now is not.  The SQL Statements are valid and work if I copy and paste them direct into the database.  They seem to not be executing within the loop (which is the big time saver for the data entry person)

I receive no error message.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<cfloop query="MarginToAdjust" >
                
					<!--- Calculate Bonus  ---->
                    <cfif (MarginToAdjust.Gross -  MarginToAdjust.StreetDirect) GTE arguments.maximum>
                    	<cfset newbonus = arguments.normalBonus>
                    <cfelse>
                    	<cfset newbonus = (arguments.percentage / 100) * (MarginToAdjust.Gross - MarginToAdjust.StreetDirect) > 
                        <cfset newbonus = int(newbonus)>
                    </cfif>
 
                    <cfquery name="update" datasource="ComSched" result="result">
                        UPDATE    AgentPayout
                        SET              Bonus = #newbonus#
                        WHERE     (PayoutID = #MarginToAdjust.PayoutID#)                        
                    </cfquery>
					<cfoutput>
					<tr>
                    	<td colspan="9"><cfdump var="#result#"> </td>
Attachments:
 
Perhaps Executed
Perhaps Executed
 
 
Zero Execution Time
Zero Execution Time
 
 
Loading Advertisement...
 
[+][-]09/21/09 12:48 PM, ID: 25386818Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/21/09 12:55 PM, ID: 25386921Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/22/09 09:44 AM, ID: 25394769Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/22/09 10:37 AM, ID: 25395383Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/22/09 12:06 PM, ID: 25396311Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/23/09 09:19 AM, ID: 25404912Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/23/09 09:32 AM, ID: 25405054Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625