Active = False before starting a Delphi application

2

Whenever we work on Datamodule on the connection component, we enable it to do tests and the like. It turns out that if we forget to deactivate when compiled, it can give an error when we send to the client due to IP or user and password to be different in development and production.

I use the TZConnection component of Zeos, but I think this goes for everyone.

I wonder if you can disable the component before or onCreate of form . I have already seen that in the onCreate event it does not work, because it activates the connection even before onCreate .

    
asked by anonymous 07.01.2016 / 15:59

2 answers

4

I decided to deal with the BeforeConnect event of the component, there I set all the variables related to the connection, taking into account whether it is Development or Production.

    
07.01.2016 / 16:49
2

Since college I learned to perform this type of procedure in the OnShow event instead of OnCreate.

And another tip I always use is to leave a default DataModule on the saved server and another one for daily use on the other machines, then when I'm going to compile the fonts, it always ends up getting the default, then this type of error due to forgetting does not happen.     

11.01.2016 / 14:19