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

# TDBDataset

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

Dataset connected to a database.

## Declaration

Source position: db.pas line 1943

`type TDBDataset = class(TDataSet)`
`public`
`destructor destroy; override;` |  | Remove the TDBDataset instance from memory.
`property DataBase: TDataBase; [rw]` |  | Database this dataset is connected to
`property Transaction: TDBTransaction; [rw]` |  | Transaction in which this dataset is running.
`end;`

## Inheritance

`TDBDataset` |  | Dataset connected to a database.
`TDataSet` |  | Base class for records-based data-access
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent,IFPObserved`
`TObject`

## Description

TDBDataset is a TDataset descendent which introduces the concept of a database: a central component (TDatabase) which represents a connection to a database. This central component is exposed in the TDBDataset.Database property. When the database is no longer connected, or is no longer in memory, all TDBDataset instances connected to it are disabled.

TDBDataset also introduces the notion of a transaction, exposed in the Transaction property.

TDBDataset is an abstract class, it should never be used directly.

Dataset component writers should descend their component from TDBDataset if they wish to introduce a central database connection component. The database connection logic will be handled automatically by TDBDataset.

## See also

TDatabase |  | Base class for connecting a FreePascal application to an external Database engine
TDBTransaction |  | Encapsulate a transaction