From RAD Studio API Documentation
Jump to: navigation, search


property EnableBCD: Boolean read FEnableBCD write FEnableBCD default 1;


__property EnableBCD = {default=1};


Type Visibility Source Unit Parent
property published
Data.Win.ADODB TADOTable


Specifies whether to treat numeric fields as floating-point or BCD.

Data.Win.ADODB.TADOTable.EnableBCD inherits from Data.Win.ADODB.TCustomADODataSet.EnableBCD. All content below this line refers to Data.Win.ADODB.TCustomADODataSet.EnableBCD.

Specifies whether to treat numeric fields as floating-point or BCD.

Use the EnableBCD property to specify how fields are mapped to field classes. If EnableBCD is true, (the default value) adDecimal and adNumeric fields are mapped to the TBCDField class when field objects are created. If EnableBCD is false, the fields are mapped to the TFloatField class.

EnableBCD determines whether numeric and decimal fields are translated as floating-point values or binary coded decimal (BCD) values. BCD values eliminate the rounding errors associated with floating point math (such as a 3 * (2/3) resulting in 2.00000000001).

If persistent field objects are used (such as those created using the Fields editor), the field class associated with a given field can contradict the setting of EnableBCD. Three numeric fields in the same table could, for instance, each be represented by a TFloatField, a TBCDField, and a TVariantField – regardless of the value in EnableBCD. Select field classes on a field-by-field basis for greater flexibility.

Note: For numeric values with more than 4 digits to the right of the decimal place, use of TFloatField is generally better. This is because TBCDField uses the currency data type that has a fixed scale of 4 decimal places.

Note: For fields with very large numbers of more than 19 significant digits, you can use TVariantField type persistent field objects. The TFloatField and TBCDField classes lack sufficient capacity for fields of this size. TVariantField allows the getting and setting of the field data as strings, preventing without loss of data due to insufficient capacity. However, arithmetic operations cannot be performed on numbers accessed through a TVariantField object.

See Also