Search code examples
sql-serverdatabasedelphifiredac

In Delphi, inactive all fdconnection, fdquery and fdtable


I want to disconnect all connections to the design-time database when running the program on client computers. Because all of them are connected to another database at the design-time and may remain connected at the time of creating a new version for release. Since in onCreate in the clients, it first connects to the test database and then my program (which includes reading the settings related to the database from the ini file and setting them) is executed, it gets an error. Also, I use firedac components to connect to the database.


Solution

  • In your TFDConnection component, there is a property called ConnectedStoredUsage.

    There you can set how the Connected property is saved in the DMF.

    Set this to auDesignTime only. Then it only connect during design-time.

    For more information, see TFDConnetction.ConnectedStoredUsage