Page 1 of 1

MySQLConnection turns on Connected property

Posted: Wed 19 Sep 2012 21:38
by skydvrz
I have a MyDAC v7.2 TMyConnection component on an IntraWeb TIWUserSessionBase form. This form is similar to a normal Delphi datamodule.

My problem is that for a number of reasons, I have to hold off connecting to my database until certain actions have been completed in my application. The initialization takes place after the datamodule has been created.

Unfortunately this component automatically sets its own Connected property to True if you make changes to any of the TMyQuery components on the same form! :?

This causes my IntraWeb app to crash on startup, if I forget to set Connected=FALSE manually before recompiling.

I have Options|KeepDesignConnected set to True.

Is this a bug, or is there some way to suppress this behavior?

Best regards,

Kevin G. McCoy

Re: MySQLConnection turns on Connected property

Posted: Thu 20 Sep 2012 07:52
by AndreyZ
Hello,

TMyConnection connects to the server only if you make changes to TMyQuery that require connection to the server (for example, creating of persistent fields, generating SQL queries using SQL Generator, etc.). Without established connection, these operation would not be possible. So, if you make changes to TMyQuery that require connection to the server but you do not want TMyConnection to be active on your application startup, you can use one of the following ways:
- set the TMyConnection.Connected property to False manually after you have made changes to TMyQuery.
- set the TMyConnection.Options.KeepDesignConnected property to False. The KeepDesignConnected property is used to prevent an application from establishing a connection at the time of startup. For more information about this property, please read the MyDAC documentation.