有朋友说:
   "设置字段的displayformat:='#0.00'";可以怎么也找不着displayformat这个属性呀???TNumericField(ADOquery1.FieldByName('hj')).DisplayFormat := '#,##0.00'
可就是出错,说找不着hj这个字段,明明有呀,不可能的呀???到底怎么设置呀??? 另外,displayformat:='#0.00'与 DisplayFormat := '#,##0.00' 有什么区别呀?
谢谢了,等会就结贴了~~~

解决方案 »

  1.   

    TAggregateField
    TDateTimeField
    TDateTimeField才有displayformat如果有多于4位整数的话,#,##0.00会多个 , 吧
    具体见帮助:
    # Digit placeholder. If the value being formatted has a digit in the position where the "#" appears in the format string, then that digit is copied to the output string. Otherwise, nothing is stored in that position in the output string.. Decimal point. The first "." character in the format string determines the location of the decimal separator in the formatted value; any additional "." characters are ignored. The actual character used as a the decimal separator in the output string is determined by the DecimalSeparator global variable. The default value of DecimalSeparator is specified in the Number Format of the Regional Settings section in the Windows Control Panel.
      

  2.   

    to   happyzsl(学习) :TAggregateField
    TDateTimeField
    TDateTimeField才有displayformat真的是这样的呀?
      

  3.   

    #.## 12.2 -> 12.2
    #.00 2.5  -> 2.50
    0.## .006 -> 00.01 那个大概就是比如#,##0.00
    就是1234.234 -》1234.23
      

  4.   

    还有个TNumericField
    上面打错了
      

  5.   

    如:在设计数据表时,如果一个字段为int型, 你就能发现displayformat这个属性,如果一个字段为varchar型,你应该是找不到displayformat这个属性的
      

  6.   

    TAggregateField
    TDateTimeField
    TNumericField才有displayformat
      

  7.   

    但我要显示的字段类型是Float,这个行吗?
      

  8.   

    我试了一下,新建的一个工程联接,
     TNumericField(ADOQuery1.Fields[0]).DisplayFormat:='#,###,##0.00';
    这个没有问题,可是到我现在的程序上就不行了,不行是什么原因,说TNumericField无效出错
      

  9.   

    float型应该是可以的!应该是你在建数据表时把field[0]设为float型就可以了
    不用强制转换
      

  10.   

    happyzsl(学习) :我试试看:)