views:

18

answers:

1

Hello I work on a data intensive module. I have a datacolumn inside a dataset which is bound to a grid. The set datacolumn property is as follows :

Datatype     : System.Decimal
MaxLength    : -1
DefaultValue : 0

With this properties i expect whenever i enter a number viz. 11001100011 to be saved as 11001100011.00

However internally this is being saved as 11001100000.00 !!!

Any ideas / inputs on correct usage of the system.decimal datatype ??

Regards Srivatsa

A: 

I can see 2 different problems, but your question is a little bit too unspecific to really get. (Some code to test would be nice)

  1. Decimal is not an ideal storage container. Just like floats and doubles it has a limited range of good values and accuracy. It just happens to be bigger.

  2. Just because something is of type Decimal, does not imply that the gui control that deals with it know how to handle such large numbers. It may convert to float first and then put it in the decimal.

Cine
To shed more light on the issue, Basically i have a grid with a dataset as the datasource. A column inside the dataset is of type System.Decimal (i need this to enter huge values). Upon entering my test values, the values that are stored and displayed are not equal. Which datatype would you suggest to store huge values
Thanks for the pointer Cine !There was one place in my code where i was converting it to float for my calculation. I removed it to get the expected results
Glad I could help :)
Cine