Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

dollarformat

Error Executing Database Query.  
[Macromedia][SQLServer JDBC Driver][SQLServer]Line 2: Incorrect syntax near '000.00'.  


73 :                         UPDATE Donations
74 :                               Set Amount = #dollarformat(rereplace(form.amount,"(\$)|(,)","","all"))#
75 :                         WHERE pledgeID = #getPledge.pledgeID# AND donationID = #getDonations.DOnationID#
76 :                   </cfquery>
77 :                   

--------------------------------------------------------------------------------
 
SQL    UPDATE Donations Set Amount = $3,000.00 WHERE pledgeID = 219 AND donationID = 11676  

How do you correct this?
0
JohnLucania
Asked:
JohnLucania
  • 2
2 Solutions
 
rob_lorentzCommented:
dollarFormat takes a number string and formats is putting the $ , and . in the number.

try using number format instead.
0
 
rob_lorentzCommented:


UPDATE Donations
    Set Amount = #numberFormat(rereplace(form.amount,"(\$)|(,)","","all"), "9999999.00")#
    WHERE pledgeID = #getPledge.pledgeID# AND donationID = #getDonations.DOnationID#
0
 
mkishlineCommented:
I've had better luck with:

Set Amount = <cfqueryparam value="#numberFormat(REReplace(form.amount,"[^0-9.]","","all"), "9999999.00")#" CFSQLType="CF_SQL_DECIMAL" />
WHERE pledgeID = <cfqueryparam value="#getPledge.pledgeID#" CFSQLType="CF_SQL_INTEGER" />
AND donationID = <cfqueryparam value="#getDonations.DOnationID#" CFSQLType="CF_SQL_INTEGER" />

But rob's answer is essentially what you'll want to do.
0
 
JohnLucaniaAuthor Commented:
That is great!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now