Unit 'DB' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#fcl]


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

Component representing the link between a local (GUI) component and a dataset.


Source position: db.pas line 2116

type TDataSource = class(TComponent)


  constructor Create(); override;


Create a new instance of TDatasource.

  destructor Destroy; override;


Remove a TDatasource instance from memory.

  procedure Edit;


Put the dataset in edit mode, if needed.

  function IsLinkedTo();


Check if a dataset is linked to a certain dataset.

  property State: TDataSetState; [r]


State of the dataset.


  property AutoEdit: Boolean; [rw]


Should the dataset be put in edit mode automatically.

  property DataSet: TDataSet; [rw]


Dataset this datasource is connected to.

  property Enabled: Boolean; [rw]


Enable or disable sending of events.

  property OnStateChange: TNotifyEvent; [rw]


Called whenever the state of the dataset changes.

  property OnDataChange: TDataChangeEvent; [rw]


Called whenever data changes in the current record.

  property OnUpdateData: TNotifyEvent; [rw]


Called whenever the data in the dataset must be updated.





Component representing the link between a local (GUI) component and a dataset.








TDatasource is a mediating component: it handles communication between any DB-Aware component (often edit controls on a form) and a TDataset instance. Any database aware component should never communicate with a dataset directly. Instead, it should communicate with a TDatasource instance. The TDataset instance will communicate with the TDatasource instance, which will notify every component attached to it. Vice versa, any component that wishes to make changes to the dataset, will notify the TDatasource instance, which will then (if needed) notify the TDataset instance. The datasource can be disabled, in which case all communication between the dataset and the DB-AWare components is suspended until the datasource is again enabled.

See also



Base class for records-based data-access.



Data event handling agent for controls.

Documentation generated on: Jul 24 2023