AnyDAC
ContentsIndexHome
PreviousUpNext
TADCustomConnection.ConnectionDefName Property

The name of connection definition to use.

Group
Links

The ConnectionDefName property specifies the name of one of a existing connection definitions. It must be stored in ADConnectionDefs.ini or created dynamically. 

Note, attempting to set ConnectionDefName when the Connected property is true raises an exception.

property ConnectionDefName: String;
ADConnection1.ConnectionDefName := 'ASA_Demo';
ADConnection1.Connected := True;

See demo AnyDAC\Samples\Comp Layer\TADConnection\ConnectionDefs for details how to create and use connection definitions.

Specifying pooled connection:

var
  oList: TStringList;
  ......
  oList := TStringList.Create;
  oList.Add('Server=MyServer');
  oList.Add('Database=Northwind');
  oList.Add('User_Name=sa');
  oList.Add('Password=');
  oList.Add('Pooled=True');
  ADManager.AddConnectionDef('myconn', 'MSSQL', oList);
  ......
  ADConnection1.ConnectionDefName := 'myconn';
  ADConnection1.Connected := True;
What do you think about this topic? Send feedback!