Execute FireDAC connection editor at run time

 ̄綄美尐妖づ 提交于 2021-02-08 11:07:36

问题


I would like to execute FireDAC connection editor at run time, but haven't found which class is the Component Editor for TFDConnection.

For example, it is easy to find out which class is the Component Editor for TADOConnection.


回答1:


You can excute FireDac connection editor by calling Execute method of TfrmFDGUIxFormsConnEdit which you can find it in FireDAC.VCLUI.ConnEdit unit.

Here is an example how to do it:

Uses ... FireDAC.VCLUI.ConnEdit;

..

var FDConnEditor : TfrmFDGUIxFormsConnEdit;
begin
    FDConnEditor := TfrmFDGUIxFormsConnEdit.Create(Self);
    try
      FDConnEditor.Execute(FDConnection1,'Caption',nil);
    finally
      FDConnEditor.Free;
    end;
end;

Now you must use the Driver ID and it's parameters to work with DBMS, so you need to use drivers you need which you can find them in FireDAC.Phys unit, for example a TFDPhysMSSQLDriverLink in FireDAC.Phys.MSSQL.pas(MS SQL Driver), or simply drop them from FireDAC Links tab in the component platte.




回答2:


The editor form for FireDAC connections is TfrmFDGUIxFormsConnEdit located in unit FireDAC.VCLUI.ConnEdit. It provides a class method called Execute you can call with the connection as the first parameter.



来源:https://stackoverflow.com/questions/46234462/execute-firedac-connection-editor-at-run-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!