MySQLConnection turns on Connected property

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
skydvrz
Posts: 32
Joined: Tue 23 Feb 2010 23:49
Location: Kissimmee, Florida USA
Contact:

MySQLConnection turns on Connected property

Post by skydvrz » Wed 19 Sep 2012 21:38

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

AndreyZ

Re: MySQLConnection turns on Connected property

Post by AndreyZ » Thu 20 Sep 2012 07:52

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.

Post Reply