在SQL Server 2000中定义数据项decimal(9,6),输入数据0.00005或0.00017并保存,在Delphi7中用TDBEdit和TDBGrid显示分别是0和0.0002,这是怎么回事?在Delphi7中用TDBEdit和TDBGrid添加数据0.00005或0.00017保存后也是0和0.0002,是不是Delphi7的TDBEdit和TDBGrid不支持5位以上小数,请各位大侠给与帮助解决。
楼主查询一下属性 DisplayFormat ,然后就可以解决了DisplayFormat property (TNumericField) Determines how a numeric field value is formatted for display in a data-aware control.DisplayFormat Value Result Comment#.## 12.2 12.2 Note extra digit to left of decimal still appears #.00 2.5 2.50 Note extra zero: field will always show two decimal places 00.## .006 00.01 Note extra zeros to right of decimal point and rounding to two decimal places.
Determines how a numeric field value is formatted for display in a data-aware control.DisplayFormat Value Result Comment#.## 12.2 12.2 Note extra digit to left of decimal still appears
#.00 2.5 2.50 Note extra zero: field will always show two decimal places
00.## .006 00.01 Note extra zeros to right of decimal point and rounding to two
decimal places.