Page 1 of 1

TZConnection

Posted: 15.11.2005, 17:09
by fefevilela
Hi,
I am using ZeosLib 6.1.5 with Postgresql.
I need to change in runtime the CONNECTED property after created and before action connect procedure.
Case the connected is TRUE (in design mode), I need to change to FALSE for change hostname and user property.
I am using a DataModule, when Delphi create this component, it´s opened the connection.
Can you help me?

Thank´s

Posted: 15.11.2005, 22:34
by tkszeos
You can change hostname and user in the event BeforeConnect of the ZConnection component.

Nicola

Posted: 16.11.2005, 09:56
by pol
Why not set connected to FALSE before compiling? So you can do everything you want in runtime (in Form.Create or Button.Click or where you need it) before setting it to TRUE again and so opening the connection.

Posted: 17.11.2005, 12:49
by fefevilela
My project create datamodule before main form. This datamodule is a generic datamodule for any customer. Case connected property is TRUE and compile project the error appear.
I am trying solve all mistakes possibilites.
I am seeking the zeos project for disable this feature, but I did not founded.
Best regards

Posted: 17.11.2005, 12:57
by fefevilela
Nicola, thank´s for you information, but do not work.

Posted: 18.11.2005, 10:29
by pol
Most of the time I do it this way:
The Datamodule is created before the Main Form. To do this, I have to change the project (.dpr) file. Connection.Connected is false.
In FormCreate of the main form I set the necessary connection parameters: username (maybe OS user), if ParamStr(1) = TEST I connect to a test database etc. When all this is done, I set Connection.connected to TRUE and so finally connect to the database. Has always worked.