Skip to content

TCustomConnection

Abstract class for connections to a server.

Declaration

Source position: db.pas line 2233

type

  TCustomConnection = class(TComponent)
  public
    procedure Close;
    destructor Destroy;
    procedure Open;
    property DataSetCount: LongInt; {r}
    property DataSets[Index : LongInt]: TDataSet; {r}
  published
    property Connected: Boolean; {rw}
    property LoginPrompt: Boolean; {rw}
    property AfterConnect: TNotifyEvent; {rw}
    property AfterDisconnect: TNotifyEvent; {rw}
    property BeforeConnect: TNotifyEvent; {rw}
    property BeforeDisconnect: TNotifyEvent; {rw}
    property OnLogin: TLoginEvent; {rw}
    property OnCloseError: TCloseErrorEvent; {rw}
  end;

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.

Properties

Member Visibility Description
AfterConnect published Event triggered after a connection is made.
AfterDisconnect published Event triggered after a connection is closed.
BeforeConnect published Event triggered before a connection is made.
BeforeDisconnect published Event triggered before a connection is closed.
Connected published Is the connection established or not.
DataSetCount read only public Number of datasets connected to this connection.
DataSets read only public Datasets linked to this connection.
LoginPrompt published Should the OnLogin be triggered.
See all Properties

Methods

Member Visibility Description
Close public Close the connection.
Destroy public Remove the TCustomconnection instance from memory.
Open public Makes the connection to the server.
See all Methods

Events

Member Visibility Description
OnCloseError published
OnLogin published Event triggered when a login prompt is shown.
See all Events

See also

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