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

# TCustomConnection

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

Abstract class for connections to a server

## Declaration

Source position: db.pas line 1880

`type TCustomConnection = class(TComponent)`
`public`
`procedure Close();` |  | Close the connection
`destructor Destroy; override;` |  | Remove the TCustomconnection instance from memory
`procedure Open;` |  | Makes the connection to the server
`property DataSetCount: LongInt; [r]` |  | Number of datasets connected to this connection
`property DataSets: TDataSet; [r]` |  | Datasets linked to this connection
`published`
`property Connected: Boolean; [rw]` |  | Is the connection established or not
`property LoginPrompt: Boolean; [rw]` |  | Should the OnLogin be triggered
`property AfterConnect: TNotifyEvent; [rw]` |  | Event triggered after a connection is made.
`property AfterDisconnect: TNotifyEvent; [rw]` |  | Event triggered after a connection is closed
`property BeforeConnect: TNotifyEvent; [rw]` |  | Event triggered before a connection is made.
`property BeforeDisconnect: TNotifyEvent; [rw]` |  | Event triggered before a connection is closed
`property OnLogin: TLoginEvent; [rw]` |  | Event triggered when a login prompt is shown.
`end;`

## Inheritance

`TCustomConnection` |  | Abstract class for connections to a server
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent,IFPObserved`
`TObject`

## Description

TCustomConnection must be used for all database classes that need a connection to a server. The class introduces some methods and classes to activate the connection (Open) and to deactivate the connection (TCustomConnection.Close), plus a property to inspect the state (Connected) of the connected.

## See also

TCustomConnection.Open |  | Makes the connection to the server
TCustomConnection.Close |  | Close the connection
TCustomConnection.Connected |  | Is the connection established or not

Documentation generated on: Feb 26 2014