Board index » delphi » Database(SQL), MDI and Datamodule

Database(SQL), MDI and Datamodule

I'm working on a mid-size database application(e.g. Inventory control). And
I would  like to make sure I'm using Delphi correctly.
Database : Microsoft SQL 6.5, using SQL Link
In my application,  I had 1 datamodule(main) with 1 TDatabase for database
connection, and multiple datamodules with datasources(TQuery). (During
design mode, all datasource are closed).
Everytime when a MDI Client form(Edit) is created, I need to create a new
instance of a related datamodule and open the related datasource.
Unfortuately, opening a datasource(TQuery) in LiveResultSet mode seem took
excessive long time( about 1 sec or more).
Am I doing something wrong ? By keep creating new datamodule instance, will
I using too much system resources ?
Please help!!!
-Tommy <8-)
MailTo : Tommy_F...@acm.NOJUNKorg

--
-Tommy <8-)
MailTo : Tommy_F...@acm.NOJUNKorg

--
-Tommy <8-)
MailTo : Tommy_F...@acm.NOJUNKorg

 

Re:Database(SQL), MDI and Datamodule


Creating instances of a data module for each form only consumes memory
for the objects in the datamodule; not much overhead.  Where is your
database component.  It should be created at the application level, and
each TQuery should reference the single database unless you have a need
for separate connections (not a good idea with MS-SQL).  You may want to
try turning on Schema Caching.  However, 1 sec. is not an "excessive
long time" for a TQuery.open under any circumstances.

Quote
Tommy S. Fung wrote:

{SNIP}
> In my application,  I had 1 datamodule(main) with 1 TDatabase for database
> connection, and multiple datamodules with datasources(TQuery). (During
> design mode, all datasource are closed).
> Everytime when a MDI Client form(Edit) is created, I need to create a new
> instance of a related datamodule and open the related datasource.
> Unfortuately, opening a datasource(TQuery) in LiveResultSet mode seem took
> excessive long time( about 1 sec or more).

{SNIP}
Quote
> --
> -Tommy <8-)
> MailTo : Tommy_F...@acm.NOJUNKorg

Other Threads