delphidatabase-connectiondatamodule

Delphi, When a datamodule loads I like to prevent the TFDConnector from connecting if I mistakenly have the activate set true


It often happens, to me, that after testing and making a build while I forget to check the activate property first. Then when I install the program on a different system an exception occurs due to failed connection. It's really annoying.

I've searched for a solution for a long time but it looks like it is impossible without making a new connection component inherited from TFDConnection. I don't want to do that and maybe someone here knows a simple way to get around this problem.


Solution

  • Check out the property ConnectedStoredUsage in TFDConnection. That controls how to use the Connected property value saved to the DFM.

    So for your need, you can uncheck auRunTime.

    For more info on ConnectedStoredUsage, see the DocWiki.