English 中文(简体)
在我使用<cfqueryparam>时,为什么会改变我的价值观?
原标题:Why is ColdFusion changing my values when I use <cfqueryparam>?

我正在使用9.0.1和2005年的服务器。

我的数据库一栏是点名。 该数字为6,1美元。

当我写Kall服务器管理演播室的问话时,如1.2或5.5,数字是正确的。 当我于1.23年下台时,它发回了1.2。 我在5.55岁时退学到5.6。 这正是我所期望的。

UPDATE TableName
SET Points = 1.2

当我向氟氯化碳和DO NOT使用CF RequestRYPARAM时,我取得了上述准确结果。

When I pass my values to the CFC uses CFQUERYPARAM, I do not get what I expect. When I drop in a number like 1.2 or 5.5, the value gets rounded to 1.0 or 6.0.

UPDATE TableName
SET Points = <cfqueryparam type="CF_SQL_DECIMAL" value="#Points#">

I have changed the CFSQLTYPE to CF_SQL_NUMERIC and CF_SQL_DECIMAL. Still, I cannot get the numbers to save correctly.

当我处理下面的氟氯化碳时,该数量储存在1.0。

UPDATE TableName
SET Points = <cfqueryparam type="CF_SQL_DECIMAL" value="1.23">

Can you help me figure out why this isn t behaving as I expect it to?

最佳回答

You need to add the scale attribute to your cfqueryparam to let it know how many decimal places to send. Add scale="2" and you should be good to go.

问题回答

我是这样说的。 它全都是SCA。 当我使用CF_SQL_时,我需要补充一下我提出的南联盟的请求。 NUMERIC and CF_SQL_DECIMAL.





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签