Search code examples
delphidatabase-connectionfiredac

Execute FireDAC connection editor at run time


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.


Solution

  • 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.