Re: Re: Delphi: using a datamodule

Posted by webmaster Guido on August 18, 2001

In Reply to: Re: using a datamodule posted by webmaster Guido on August 17, 2001

: : I recently read that if using filters with datasets you shouldn't use a datamodule. What would be the reason for this?

: Can you please tell me were you read that, so that I can check out the source?
: [...and so on...]

 

Andrew has sent me a message, saying that he found this info in a series of database programming articles by the "Delphi About Guide". Since this is a well-respected source, I became curious...

I tested with a Paradox table with 15,000 records, no indexes, using TTable components to which I applied several filters, and I didn't find any performance (speed) difference between a TTable in a datamodule and a TTable that is directly on the form.

I repeated the tests using TQuery components and filters, with the same results. Then I repeated the comparison tests with TTable components and a Paradox table with several types of indexes, still no difference between datamodule / no datamodule.

So, I can only guess why the Delphi-About-Guide advises against filters and datamodules: because it can make the programming more complicated? As in: having a dataset in a datamodule that is used by several forms, and making sure that you set or reset the filters at the correct moment?

IMHO, this is purely a question of personal preferences, I can't find any technical reasons for using or not using a datamodule.

Guido, webmaster DelphiLand

 

DelphiLand Forum

Delphi Tutorials