Hello,

Imagine a situation where you have to create 5 ado connections; 6
adoqueries, an indy smtp, indy ftp component then use them.

I'd rather drop them on a datamodule then create the datamodule on the fly
and use all the components within, better than creating them  one by one
then freeing them one by one.

Chris

PO Box 627 00502 Karen, 
Nairobi, Kenya.
Mobile: +254 722 996532
Fixed: +254 20 2050859
[EMAIL PROTECTED]


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Theodoros Bebekis
Sent: 17 January 2008 4:00 p
To: [email protected]
Subject: Re: [delphi-en] TDataModule or TADODataSet.Create

O/H anomander1 έγραψε:
> 
> 
> Hello,
> 
> I have a question regarding the use of TDataModule.
> When i first started using Delphi, i always set Datafiles on
> TDataModule. Now though, i code my datasets with
> 
> ado := TADODataSet.Create.....
> 
> Can anyone point me in the direction of what i should use?
> using ado := ... seems faster for me to use.
> Is there any reason why i should not do this?
> 
> TIA
> 
> Marco

TDataModule is JUST a TComponent with a .dfm resource
visible at design-time. It could be usefull to a
programmer who prefers the design-time "coding"
that is using the Object Inspector.
There is nothing magical to it.

Droping components on a TDataModule gives you
the impression of easyness and speed in
programming. Everything droped on it
is automatically destroyed. But you
can not control the order of distruction.
Unless you code it.

You can have the same functionality by just
coding it by hand. The way you do
ado := TADODataset.Create....

In fact, I prefer this second way
because it gives a better oversight
to the programmer.

You may code your own "version" of a
TDataModule-like class, to be more general
and more usefull and more suitable to
many cases. Say a TComponent descendant
(TBaseModule?) with a windows handle, capable of receiving
messages, which provides a set of virtual
methods like Select(ID: Integer), Delete(ID: Integer)
etc etc, and which represents a set of relative
database tables, with one of them as the top
table. Of cource you can have the same result
by having TDataModule as your base class.

-- 
Regards
Theo

------------------------
Theo Bebekis
Thessaloniki, Greece
------------------------
Greek_Delphi_Prog : a Delphi Programming mailing list in Greek at
    http://groups.yahoo.com/group/Greek_Delphi_Prog

CSharpDotNetGreek : A C# and .Net mailing list in Greek language at
    http://groups.yahoo.com/group/CSharpDotNetGreek

atla_custom : a Unisoft Atlantis Customization mailing list at
    http://groups.yahoo.com/group/atla_custom
------------------------


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links







-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/delphi-en/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to