API:FireDAC.Comp.Client.TFDConnection.ConnectionName
Delphi
property ConnectionName: string read FConnectionName write SetConnectionName default 0;
C++
__property ConnectionName = {default=0};
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDConnection |
Description
Specifies the name of the connection to associate with this connection object.
FireDAC.Comp.Client.TFDConnection.ConnectionName inherits from FireDAC.Comp.Client.TFDCustomConnection.ConnectionName. All content below this line refers to FireDAC.Comp.Client.TFDCustomConnection.ConnectionName.
Specifies the name of the connection to associate with this connection object.
Use ConnectionName to specify the name of the connection to use with a connection object. If ConnectionName is the same as an existing connection definition, then the ConnectionDefName and DriverName properties need not be set. If ConnectionName does not match an existing connection definition, then either the application must also supply a valid connection definition in the ConnectionDefName property or it must supply the DriverName and Params properties.
You can specify the connection name of one of the existing TFDConnection objects or the name of one of the existing connection definitions as a connection name for the TFDCustomCommand or TFDRDBMSDataSet component and its descendants (TFDQuery, TFDStoredProc, TFDTable).
Notes:
- Attempting to set ConnectionName when the Connected property is True raises an exception.
- At design time, double-click a TConnection component to invoke the Database editor and set the ConnectionName.
Example
FDConnection1.ConnectionName := 'TestConn';
FDConnection1.DriverName := 'Oracle';
FDConnection1.Params.Add('Database=testdb');
....
FDQuery1.ConnectionName := 'TestConn';
FDQuery1.Open('select * from test_tab');