Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Multi units Database


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 30, 2015 11:23 AM Last Post By: Peter Below
Manlio Laschena

Posts: 11
Registered: 11/17/99
Multi units Database  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 29, 2015 1:55 PM
Multi units Database
I have a multi units applications. In the first unit/form I set and open a Database and the first table. In the next unit I would like to open a second table, whose components (Table and DataSouce) have been installed in the second form.
Despite I gave great care to set the appropriate uses clauses (to link the units) and specified the correct dataset along all the components, I get an error for Table not found.
My question is: can I locate the TTable components in different forms, according to where they are going to be used, or I have to put them all in the main form ?
Thanks
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Multi units Database  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 30, 2015 11:23 AM   in response to: Manlio Laschena in response to: Manlio Laschena
Manlio Laschena wrote:

Multi units Database
I have a multi units applications. In the first unit/form I set and
open a Database and the first table. In the next unit I would like to
open a second table, whose components (Table and DataSouce) have been
installed in the second form. Despite I gave great care to set the
appropriate uses clauses (to link the units) and specified the
correct dataset along all the components, I get an error for Table
not found. My question is: can I locate the TTable components in
different forms, according to where they are going to be used, or I
have to put them all in the main form ? Thanks

You should put database access components on a TDatamodule that is the
used by the forms. This way the forms do not need to know about each
other, they only need to know about the datamodule.

Each form can then have its own TDatasource, with its dataset property
set to the table on the datamodule. The controls are then linked to
this datasource. The only thing you need to be aware of in such a
scenario is that operations on a given dataset will affect all forms
that are linked to this dataset, not only the form the user does the
operation on. That is sometimes intended behaviour, but if it does not
work for you you have no choice but to create different datasets for
the forms, even if they refer to the same database table or query.

--
Peter Below (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02