Issue while saving system.decimal values in a dataset
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 dataty开发者_C百科pe ??
Regards Srivatsa
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)
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.
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.
精彩评论