weary as water

every time i blink i have a tiny dream

Flex 4 vs ColdFusion vs SQL Server data typing: Issues with Rounding

I have been pulling my hair out for a few hours, trying to figure out why Flex seemed to be automatically rounding numbers en route to the SQL Server (via Coldfusion). It was hard enough figuring out how to set a datatype to Number (the flex typing generator automatically sees decimal values as “string”, so to set the type as “number” you need to make sure the column in SQL server is empty before configuring the return type. Flex will configure that column as an “object”, and you can cast it as a Number (using the dropdown box) before saving the return type).

Basically, when you configure a return type to use a Number, the coldfusion service uses a cfsqltype=CF_SQL_DECIMAL type in it’s update & create services. This sends a rounded integer to the SQL server, instead of an actual decimal amount. When I changed this to cfsqltype=CF_SQL_VARCHAR, everything behaved normally. (And surprisingly, SQL server did not complain about the improperly typed object).