RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TBCDField Class

TBCDField represents a binary-coded decimal (BCD) field in a dataset.

Pascal
TBCDField = class(TNumericField);
C++
class TBCDField : public TNumericField;

DB

TBCDField encapsulates the fundamental behavior common to binary-coded decimal (BCD) fields. BCD values provide greater precision and accuracy than floating-point numbers. BCD fields are often used for storing and manipulating monetary values.  

The IDE uses two different field types for representing BCD fields: TBCDField and TFMTBCDField. TBCDField uses the Currency (Delphi) or System::Currency (C++) type to manipulate BCD values. This is faster than storing and manipulating the value using a true BCD type, but limits the precision of the BCD values it can support to 4 decimal places and 20 significant digits. 

TBCDField converts the data from a BCD value to a Currency value when it fetches the data from the database table, and converts it from a Currency value to a binary-coded decimal value when it posts the data. If the underlying database table contains a value that requires greater precision, TBCDField raises an exception. If your application requires BCD values with more than 4 decimal places or 20 significant digits, you should use TFMTBCDField instead. TFMTBCDField is a true BCD, with the precision of the binary-coded decimal type (TBCD) but with somewhat slower performance. 

If you use the Fields editor at design time to create a persistent field component for the BCD field, you can access it by name at runtime. When using dynamic field components, you can access the TBCDField instance using the dataset's Fields property or FieldByName method. 

 

TDataSet 

TDataSet 

TDataSet 

TFloatField 

TFMTBCDField 

TBcd 

Using Default Formatting for Numeric

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!