Data.DB.TField

From RAD Studio API Documentation
Jump to: navigation, search

System.Classes.TComponentSystem.Classes.TPersistentSystem.TObjectTField

Delphi

TField = class(TComponent)

C++

class PASCALIMPLEMENTATION TField : public System::Classes::TComponent

Properties

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

Description

TField is the common ancestor of all the field components.

TField encapsulates the fundamental behavior common to all field components. It introduces the properties, events, and methods that are used to:

  • Change the value of a field in a dataset.
  • Convert the value of a field from one data type to another.
  • Validate data that the user enters for a field.
  • Define how the data in the field appears as it is displayed or edited.
  • Calculate the value of a field from code written in the OnCalcFields event of the dataset.
  • Look up the field's value from another dataset.

Do not create instances of TField. TField descendants are created automatically each time a dataset is activated. These descendants can be dynamic (the default) or persistent. Dynamic field components reflect the columns in the underlying metadata at the time a dataset is opened. Persistent field components are created at design time using the Fields editor, which specifies the fields in the dataset, their properties, and their ordering.

Creating persistent field components guarantees that each time an application runs, it uses and displays the same columns, in the same order, even if the physical structure of the underlying database changes. If a column on which a persistent field component is based is deleted or changed, the IDE generates an exception rather than opening the dataset against a nonexistent column or mismatched data. If this happens, remove the field component for the nonexistent field using the Fields editor.

Reading the Value of a TField Object

Use the DataType property to find out which type of value a TField object contains.

Use one of the properties prefixed with As to obtain the value of the TField object using a suitable type:

If you read a property that is not suitable for the type of your TField object, an exception raises.

If your TField object contains a null value, IsNull is True. When you read the value of a TField object that contains a null value, you obtain the default value of the corresponding type; for example, AsInteger is 0 for a null value.

Subclasses

A field in a dataset is always treated as one of the following TField descendant classes:

Descendant class Description

TADTField

A TADTField object represents an ADT (Abstract Data Type) field in a dataset.

TDateField

TDateField represents a date field in a dataset.

TReferenceField

TReferenceField represents a REF field in a dataset.

TAggregateField

TAggregate field represents a maintained aggregate in a client dataset.

TDateTimeField

TDateTimeField represents a date-time field in a dataset.

TSmallintField

Represents a signed 16-bit integer field in a dataset.

TArrayField

TArrayField represents an Array field in a dataset.

TFloatField

TFloatField represents a field that contains floating-point values in a dataset.

TSQLTimeStampField

TSQLTimeStampField represents a date-time field in a DBExpress dataset.

TAutoIncField

TAutoIncField is a persistent field object for an autoincrement field in a dataset.

TFMTBCDField

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

TStringField

TStringField represents a string field in a dataset.

TBCDField

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

TGraphicField

TGraphicField represents a graphics field in a dataset.

TTimeField

TTimeField represents a time field in a dataset.

TBinaryField

TBinaryField represents an untyped binary field in a dataset.

TGuidField

TGuidField represents a guid field in a dataset.

TVarBytesField

TVarBytesField represents a variable-length untyped binary field in a dataset.

TBlobField

TBlobField represents a field in a dataset that holds a reference to a binary large object (BLOB).

TIDispatchField

TIDispatchField represents an IDispatch field in a dataset.

TVariantField

TVariantField represents a variant field in a dataset.

TBooleanField

TBooleanField represents a field containing Boolean values.

TIntegerField

Represents a signed 32-bit integer field in a dataset.

TWideStringField

TWideStringField represents a large string field in a dataset.

TBytesField

TBytesField represents a bytes field in a dataset.

TInterfaceField

TInterfaceField represents an interface field in a dataset.

TWordField

Represents an unsigned 16-bit integer field in a dataset.

TCurrencyField

TCurrencyField represents a field that contains currency values in a dataset.

TLargeintField

A TLargeintField object represents a large integer field in a dataset.

TDataSetField

TDataSetField provides access to nested datasets.

TMemoField

TMemoField represents a memo field in a dataset.

See Also