Question

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 (sums, 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?

Was it helpful?

Solution

Try this:

ADODataSet.FieldByName('AField').Currency := True;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top