Board index » delphi » ADOconnections and multiple datamodules

ADOconnections and multiple datamodules

Hi.

I have an app with many forms and many datamodules (most forms have a
datamodule). Each datamodule has its own ADOconnection.

It is like this because when I tried using one ADOConnection for all the
datamodules (ie, the conection on one of the datamodules and other
datamodules referred to this) Delphi threw errors.

For deployment, it would be easier to have one connection for the app,
referred to in all other data modules, so I can just change the connection
once as required.

The question is: is there a problem with having only one connection on one
module and accessing it from other data modules? Or do different datamodules
have to have, in principle or in practice, a new connection on each module?

Thanks,

Lauchlan M.

 

Re:ADOconnections and multiple datamodules


Hi Lauchlan

Unlike you I started with one datamodule, and one connection, but as my
application grew I now have some data components on the form that uses them
(multiple instantiations needed). These all reference the connection on the
one datamodule, and I have no problems. (D5)

Not quite the multiple datamodule situation  you ask about, but should be
similar. What errors do you get if you refer to the connection on one
datamodule from another?

Quote

> For deployment, it would be easier to have one connection for the app,
> referred to in all other data modules, so I can just change the connection
> once as required.

Yes, indeed!!

Dave

Re:ADOconnections and multiple datamodules


I have one Datamodule and wrote a 'SpreadConnection' routine
that I call to set the connection of any table/dataset/query on the
form to the connection in that dataset.

Does your error occur on closing a connection or on establishing
the connection property of a dataset to the datamodules connection?

[The only time I get errors is if I forget to close, and only sometimes.]

Do you have the most recent ADO?  [I had a few problems with BOF/EOF
{*word*99} until I updated]

Steve@Dave's.Desk

Quote
"Lauchlan M" <LMackin...@Hotmail.com> wrote in message

news:3d042025_2@dnews...
Quote
> Hi.

> I have an app with many forms and many datamodules (most forms have a
> datamodule). Each datamodule has its own ADOconnection.

> It is like this because when I tried using one ADOConnection for all the
> datamodules (ie, the conection on one of the datamodules and other
> datamodules referred to this) Delphi threw errors.

> For deployment, it would be easier to have one connection for the app,
> referred to in all other data modules, so I can just change the connection
> once as required.

> The question is: is there a problem with having only one connection on one
> module and accessing it from other data modules? Or do different
datamodules
> have to have, in principle or in practice, a new connection on each
module?

> Thanks,

> Lauchlan M.

Re:ADOconnections and multiple datamodules


Another small thought....

Were the problems caused by the order in which the datamodules were
instantiated? I have to make sure that my datamodule (with connection) is
there long before the forms with the additional data access components on
are created.

Dave

Re:ADOconnections and multiple datamodules


Lauchlan,

    Email me privately and I'll send you what I use.  Basically each
form/datamodule has a Connection property (of type TADOConnection) with a
procedure that sets all the ADO component's connection property.  Our
website uses this method (100% WebBroker CGI with one ADOConnection and
multiple child datamodules) with zero problems.

krf

Quote
"Lauchlan M" <LMackin...@Hotmail.com> wrote in message

news:3d042025_2@dnews...
Quote
> Hi.

> I have an app with many forms and many datamodules (most forms have a
> datamodule). Each datamodule has its own ADOconnection.

> It is like this because when I tried using one ADOConnection for all the
> datamodules (ie, the conection on one of the datamodules and other
> datamodules referred to this) Delphi threw errors.

> For deployment, it would be easier to have one connection for the app,
> referred to in all other data modules, so I can just change the connection
> once as required.

> The question is: is there a problem with having only one connection on one
> module and accessing it from other data modules? Or do different
datamodules
> have to have, in principle or in practice, a new connection on each
module?

> Thanks,

> Lauchlan M.

Re:ADOconnections and multiple datamodules


oops, and my email is
kfrev...@midwayNOSPAMusa.com

remove the NOSPAM

krf

Quote
"Kevin Frevert" <kfrevert@shootthespammerscom> wrote in message

news:3d04e99d$1_2@dnews...
Quote
> Lauchlan,

>     Email me privately and I'll send you what I use.  Basically each
> form/datamodule has a Connection property (of type TADOConnection) with a
> procedure that sets all the ADO component's connection property.  Our
> website uses this method (100% WebBroker CGI with one ADOConnection and
> multiple child datamodules) with zero problems.

> krf

Other Threads