FireDAC.Comp.Client.TFDCustomManager.AddConnectionDef
Delphi
procedure AddConnectionDef(const AName, ADriver: string; AList: TStrings = nil;
APersistent: Boolean = False);
C++
void __fastcall AddConnectionDef(const System::UnicodeString AName, const System::UnicodeString ADriver, System::Classes::TStrings* AList = (System::Classes::TStrings*)(0x0), bool APersistent = false);
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomManager |
説明
private の接続定義を追加します。
AddConnectionDef メソッドは、新たな private もしくは永続接続定義を、ConnectionDefs リストに追加します。
接続定義は、名前 AName
、DriverID ADriver
、パラメータ AList
を取得します。名前は、ConnectionDefs リスト内の他の接続定義に渡っても一意でなければならず、そうでなければ例外が発生します。
APersistent
を True に設定すると、接続定義は永続としてマークされ、そうでなければ、これは private となります。呼び出しの後、永続接続定義はファイルに格納されません。SaveConnectionDefFile を呼び出すと、これと他の変更をファイルに保存することができます。格納されない接続定義は、FireDAC マネージャまたはアプリケーションが終了した時点で、破棄されます。
接続定義が追加された後、TFDCustomConnection.ConnectionDefName によって参照できます。
例:
var
oList: TStringList;
......
oList := TStringList.Create;
oList.Add('Server=127.0.0.1');
oList.Add('Database=addemo');
FDManager.AddConnectionDef('myconn', 'MySQL', oList);
......
FDConnection1.ConnectionDefName := 'myconn';
FDConnection1.Connected := True;
関連項目
- 接続を定義する
- FireDAC.Comp.Client.TFDCustomManager.ConnectionDefs
- FireDAC.Comp.Client.TFDCustomManager.SaveConnectionDefFile
- FireDAC.Comp.Client.TFDCustomManager.DeleteConnectionDef
- FireDAC.Comp.Client.TFDCustomManager.ModifyConnectionDef