FireDAC.Comp.Client.TFDCustomConnection.ConnectionName

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ConnectionName: String read FConnectionName write SetConnectionName;

C++

__property System::UnicodeString ConnectionName = {read=FConnectionName, write=SetConnectionName};

Properties

Type Visibility Source Unit Parent
property public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDCustomConnection

Description

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');

See Also