Skip to main content
Participant
Jan 22, 2013 1:48 AM UTC
Question

CF_SQL_FLOAT is changing data

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 is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
Jan 22, 2013 1:24 PM UTC

You might have better luck with cf_sql_decimal.

Translate