[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'DB' (#fcl)

# TDataLink

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Data event handling agent for controls

## Declaration

Source position: db.pas line 1785

`type TDataLink = class(TPersistent)`
`public`
`constructor Create;` |  | Initialize a new instance of TDataLink
`destructor Destroy; override;` |  | Remove an instance of TDatalink from memory
`function Edit;` |  | Set the dataset in edit mode, if possible
`procedure UpdateRecord;` |  | Called when the data in the dataset must be updated
`function ExecuteAction(); virtual;` |  | Execute action
`function UpdateAction(); virtual;` |  | Update handler for actions
`property Active: Boolean; [r]` |  | Is the link active
`property ActiveRecord: Integer; [rw]` |  | Currently active record
`property BOF: Boolean; [r]` |  | Is the dataset at the first record
`property BufferCount: Integer; [rw]` |  | Set to the number of record buffers this datalink needs.
`property DataSet: TDataSet; [r]` |  | Dataset this datalink is connected to
`property DataSource: TDataSource; [rw]` |  | Datasource this datalink is connected to
`property DataSourceFixed: Boolean; [rw]` |  | Can the datasource be changed
`property Editing: Boolean; [r]` |  | Is the dataset in edit mode
`property Eof: Boolean; [r]` |  |
`property ReadOnly: Boolean; [rw]` |  | Is the link readonly
`property RecordCount: Integer; [r]` |  | Number of records in the buffer of the dataset
`end;`

## Inheritance

`TDataLink` |  | Data event handling agent for controls
`TPersistent,IFPObserved`
`TObject`

## Description

TDataLink is used by GUI controls or datasets in a master-detail relationship to handle data events coming from a TDatasource instance. It is a class that exists for component programmers, application coders should never need to use TDataLink or one of it's descendents.

DB-Aware Component coders must use a TDatalink instance to handle all communication with a TDataset instance, rather than communicating directly with the dataset. TDataLink contains methods which are called by the various events triggered by the dataset. Inversely, it has some methods to trigger actions in the dataset.

TDatalink is an abstract class; it is never used directly. Instead, a descendent class is used which overrides the various methods that are called in response to the events triggered by the dataset. Examples are .

## See also

TDataset |  | Base class for records-based data-access
TDatasource |  | Component representing the link between a local (GUI) component and a dataset
TDetailDatalink |  | Represents the link between a detail data source and a master datasource.
TMasterDataLink |  | Datalink for Master-Detail relationships between datasets.