TZConnection

Forum related to version 6.1.5 of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
User avatar
fefevilela
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.11.2005, 17:02
Location: brazil

TZConnection

Post 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
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

Post by tkszeos »

You can change hostname and user in the event BeforeConnect of the ZConnection component.

Nicola
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post 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.
User avatar
fefevilela
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.11.2005, 17:02
Location: brazil

Post 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
User avatar
fefevilela
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.11.2005, 17:02
Location: brazil

Post by fefevilela »

Nicola, thank´s for you information, but do not work.
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post 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.
Post Reply