Skip to main content
Participant
January 22, 2013
Question

CF_SQL_FLOAT is changing data

  • January 22, 2013
  • 1 reply
  • 613 views

Hi guys,

if i'm not using cf_sql_float for data checking, then after execute, the data would be 500.55 in database.

<cfset a = 500.55>

<cfquery name="qs_pp" datasource="#dsn#">

update  pos_retail_item_trans

set unit_price =#a#,

sub_total = #a#

where shopping_cart_item_id = 1024694

</cfquery>

But if i use cf_sql_float like the following, the data would become 500.55000000000001 in database. it seems that the cf_sql_float could change the data.  Is there any solution to this problem?

<cfset a = 500.55>

<cfquery name="qs_pp" datasource="#dsn#">

update  pos_retail_item_trans

set unit_price =<cfqueryparam value="#a#" cfsqltype="CF_SQL_FLOAT">,

sub_total = <cfqueryparam value="#a#" cfsqltype="CF_SQL_FLOAT">

where shopping_cart_item_id = 1024694

</cfquery>

This topic has been closed for replies.

1 reply

Inspiring
January 22, 2013

You might have better luck with cf_sql_decimal.