Data.DB.TCustomConnection.Connected
Delphi
property Connected: Boolean read GetConnected write SetConnected default False;
C++
__property bool Connected = {read=GetConnected, write=SetConnected, default=0};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | Data.DB.pas Data.DB.hpp |
Data.DB | TCustomConnection |
Description
Determines whether a connection has been established to the remote source of data and is active.
Set Connected to True to open the connection. Set Connected to False to terminate the connection.
Setting Connected to True generates a BeforeConnect event, calls the protected DoConnect method to establish the connection, and generates an AfterConnect event. In addition, when setting Connected to True TCustomConnection may display a login dialog, depending on the value of LoginPrompt.
Setting Connected to False generates a BeforeDisconnect event, calls the protected DoConnect method to drop the connection, and generates an AfterDisconnect event.
When deriving custom connection components from TCustomConnection, override GetConnected to return True when a connection is established, and override DoConnect and DoDisconnect to create and drop the connection.