Board index » delphi » DataModules or not?

DataModules or not?

Does anyone know of a good reason not to use datamodules?  I am working on
an app that seems like it might make more sense to put the TQuerys and
Datasource on the forms.

Is there any performance reduction not using a Datamodule?

Thanks

 

Re:DataModules or not?


  A good reason not too?  --  no...  You should be using them (especially if
you have multiple forms using the same database....)  --  All they are is a
specialized form....

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are Microsoft.  You will be assimilated.  Resistance is Futile."
--

Quote
Annette Gallagher wrote in message <6ob7gm$3d...@news.inc.net>...
>Does anyone know of a good reason not to use datamodules?  I am working on
>an app that seems like it might make more sense to put the TQuerys and
>Datasource on the forms.

>Is there any performance reduction not using a Datamodule?

>Thanks

Re:DataModules or not?


Quote
Annette Gallagher wrote:

> Does anyone know of a good reason not to use datamodules?  I am working on
> an app that seems like it might make more sense to put the TQuerys and
> Datasource on the forms.

> Is there any performance reduction not using a Datamodule?

IMHO datamodule advisable if several forms used one Datasource...

Quote

> Thanks

--
Best regards, Alexey.

Re:DataModules or not?


Quote
Annette Gallagher wrote:

> Does anyone know of a good reason not to use datamodules?  I am working on
> an app that seems like it might make more sense to put the TQuerys and
> Datasource on the forms.

> Is there any performance reduction not using a Datamodule?

> Thanks

Hi Annette,

It would be interesting to see your reasons why you think this.

From my own experience, it is almost never a good thing to have the same
thing more than once in an app. - in your case, I'm thinking of record
layouts, SQL, etc., etc.

Maintenance Rule 1 - if the same thing exists more than once, it's
absolutely *guaranteed* that, sooner or later, it'll be changed in one
place and not the other(s).

Maintenance Rule 2 - even if each form uses a different query now, it's
absolutely *guaranteed* that, sooner or later, either at least one query
will be modified so that it is the same as another one (then Rule 1 will
apply) or a form will need to use an existing query that it doesn't use
now (then Rule 1 will apply).

Finally, it's worth remembering that you can put the TQuery's in a
DataModule but have the corresponding TDataSource(s) on the forms as
required.

Regards,

Stuart

Re:DataModules or not?


What does the dataModule change about memory ?
If there are many different Tables, will not they be created in memory when
creating the DataModule ?
If the table is in one form maybe only this form is in memory and only this
table ?

I hope you can anderstand something with my bad english...

Regards,

Fran?ois

Re:DataModules or not?


I can think of one. If you have two forms that can be opened at the
same time but use different views of the data. For instance, form1
sees data from table1 to table2, but form2 sees the data from table2
to table1. This will cause conflicts in the record pointers. If your
forms use different tables, then you should always try to use a
datamodule.

Woody

Quote
Annette Gallagher wrote in message <6ob7gm$3d...@news.inc.net>...
>Does anyone know of a good reason not to use datamodules?  I am
working on
>an app that seems like it might make more sense to put the TQuerys
and
>Datasource on the forms.

>Is there any performance reduction not using a Datamodule?

>Thanks

Other Threads