Change Connection between Microsoft Access and SQL-Server on the run

Hello,

is there a way to change the database-connection between Microsoft Access and SQL-Server without having two different reports?


Greetings

Dominic

Comments

  • Hello!

    If the table structure and column names are the same, connect to the required database in the application code (populate the DataSet/DataTable via OleDbConnection or SqlConnection), clear the built-in connection in the dictionary, and pass the data via RegisterData(...):

    report.Load(‘template.frx’);
    report.Dictionary.Connections.Clear();
    report.RegisterData(dataSet);
    report.Prepare();
    

    If you specifically need the built-in connector within the .frx file, set the connection type (e.g. MsSqlDataConnection vs OleDbDataConnection via connector plug-ins) at runtime, or move the queries into the code and pass a standardised DataSet / List<T> to FastReport

This discussion has been closed.