RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TADOConnection.Connected Property

Specifies whether the connection is active.

Pascal
property Connected: Boolean;
C++
__property Boolean Connected;

Set Connected to trueto establish a connection to an ADO data store without opening a dataset. Set Connected to false to close a connection. The default value for Connected is false. 

An application can check Connected to determine the current status of a connection. If Connected is true, the connection is active; if false, and the KeepConnection property is also false, then the connection is inactive. 

Connected can also be used in a program to determine the success of a call to the Open method (a true value in Connected) or the Close method (a false value).

with ADOConnection1 do begin
  Open;
if Connected then
    { connection successful }
else
    { connection unsuccessful };
end;

 

ADOConnection1->Open();
if (ADOConnection1->Connected)
  // connection successful
else
  // connection unsuccessful

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!