[Mono-list] SqlDBType.Money processed wrong with mono 2.6.4
Piotr Wysocki
piotr.wysocki at secpl.cs.put.poznan.pl
Mon Jun 14 03:08:46 EDT 2010
On 06/13/2010 11:37 AM, Jacek Rużyczka wrote:
> Hi,
>
> Am Sonntag 13 Juni 2010 10:59:35 schrieb Josef Semmler:
>> Hi,
>>
>> i'm either doing someing stupid - or there is a bug with handling
>> SqlDBType.Money in mono 2.6.4 ... please help me.
>>
>> I have a sqlserver 2005 - in a table with an attribute "Amount" of type
>> "Money" i try to store different values, which are in the c# code
>> represented as "decimal" - for any reason, the values are stored completly
>> wrong.
>>
> I would suppose that MONEY is a fixed-point data type, which means that the
> decimal point is always two positions left of the last digit. This is why your
> code stores values like 144.568 incorrectly.
That is not exactly true.
Bank applications for its calculations need four digits after the
decimal point. Also consider that currency exchange rates use four
digits after the decimal point :)
The MONEY data type is a 64-bit signed integer with the last four digits
being after the decimal point, so the values covered are
from -2^63 / 10^4 to (2^63 - 1) / 10^4
I think only those:
AddItem((decimal)12.34567);
AddItem((decimal)12.345678);
should not work, the rest should work.
Cheers,
--
Piotr Wysocki
Mobile Systems Research Labs, Poznan University of Technology
More information about the Mono-list
mailing list