想把数据库中,JIA_GE字段格式化为0.00这样的形式,如1,自动显示为1.00.可是下面的代码好像任何效果也没有ZQuery1.Connection:=ZConnection1;
ZQuery1.SQL.Text:='Select * from Table1';
ZQuery1.Active:=True;
TNumericField(ZQuery1.FieldByName('JIA_GE')).DisplayFormat:='0.00';若把上面的ZQuery控件换为IBQuery,则可以达到我要的效果。但是我已经使用ZQuery控件了,不想再改了,如何把JIA_GE字段格式化显示的0.00的形式啊,好像DBGridEh有DisplayFormat的属性,但是我只想用DBGrid。谁能给出一个有用的解决方案。谢谢。
ZQuery1.SQL.Text:='Select * from Table1';
ZQuery1.Active:=True;
TNumericField(ZQuery1.FieldByName('JIA_GE')).DisplayFormat:='0.00';若把上面的ZQuery控件换为IBQuery,则可以达到我要的效果。但是我已经使用ZQuery控件了,不想再改了,如何把JIA_GE字段格式化显示的0.00的形式啊,好像DBGridEh有DisplayFormat的属性,但是我只想用DBGrid。谁能给出一个有用的解决方案。谢谢。
小数点前的0表示有前导0,小数点后的两个0,表示有且只有两位小数。 与这个是一样的:
Edit1.Text:=FormatFloat( '$0.00 ',StrToFloat(Edit1.Text))2.写字段的OnGetText事件
if sender.value=1243.256 then
text := '$1243.256 ';(dbgrid1.datasource.dataset.fieldbyname( 'aaa ') as tfloatfield).
displayformat:= '#0.00 ';
var Value: Extended ;
begin
Value:=5678.34;
Edit3.Text:=FormatFloat('0.00',Value);
end;