Show: Delphi C++
Display Preferences

Data.DB.TBCDField

From RAD Studio API Documentation
Jump to: navigation, search

Data.DB.TNumericFieldData.DB.TFieldSystem.Classes.TComponentSystem.Classes.TPersistentSystem.TObjectTBCDField

Delphi

TBCDField = class(TNumericField)

C++

class PASCALIMPLEMENTATION TBCDField : public TNumericField

Properties

Type Visibility Source Unit Parent
class public
Data.DB.pas
Data.DB.hpp
Data.DB Data.DB

Description

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

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.

See Also

Code Examples

Personal tools
RAD Studio 10.2 Tokyo
In Other Languages
Previous Versions
Assistance