问题
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