开发者

Issue with ftCurrency fields with ADODatasets

I have an accuracy problem with a reporting tool that I'm using. The issue is that it is reading in data from a TADODataset on the fly but converting the ftBCD fields into doubles.

This causes rounding errors when performing operations at the reporting level (s开发者_Go百科ums, etc).

I'd like to specify my currency fields as ftCurrency, not ftBCD to stop this from hapening.

If I create a field as:

TFieldDef.Create( ADODataset.FieldDefs,
    'test',
    ftCurrency,
    0,
    True,
    0
  );   

ADODataset.CreateDataSet;

Using the watch, I can now see that ADODataset.Fields[0].DataType has a value of ftBCD.

Is there a way to explicitly specify a ftCurrency field within a TADODataset so it's not assigned as a ftBCD field?


Try this:

ADODataSet.FieldByName('AField').Currency := True;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜