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

# TCustomConnection.Open

Makes the connection to the server

## Declaration

Source position: db.pas line 1908

`public procedure TCustomConnection.Open;`

## Description

Open establishes the connection with the server if it was not yet connected. Calling this method first triggers the BeforeConnect event. If an exception is raised during the execution of that event handler, the connect process is aborted. If LoginPrompt is True, the OnLogin event handler is called. Only after this event, the connection is actually established. After the connection was established, the AfterConnect event is triggered.

Calling the Open method is equivalent to setting the Connected property to True.

## Errors

If an exception is raised during the BeforeConnect or OnLogin handlers, the connection is not actually established.

## See also

TCustomConnection.BeforeConnect |  | Event triggered before a connection is made.
TCustomConnection.LoginPrompt |  | Should the OnLogin be triggered
TCustomConnection.OnLogin |  | Event triggered when a login prompt is shown.
TCustomConnection.AfterConnect |  | Event triggered after a connection is made.
TCustomConnection.Connected |  | Is the connection established or not

Documentation generated on: Feb 26 2014