I was wondering what is the "right" way to deal with datasets is.
Particularly sharing DataSets between forms. Here is my situation.
I have a simple Customer Database, that holds some information about
Customers including thier address. Lets call this Table "Customers".
The Customers Table references another Table for Address information,
for instance I have a table of "Zipcodes",
Now I want an app with two forms, one form to browse my customers in a
report format and one form to edit one customer in my database. The
first form probably just contains a Datagrid but the second has a bunch
of controls bound to tables in the Dataset. For instance a combo box
for State that is bound to the "States" Table in my dataset.
Question 1: Should all the related tables be in one Dataset or should I
make a separate Dataset for each table. (Remember the tables are
referenced).
Question 2: Should each form have it's own set of DataAdapters and
Datasets?
If the forms each have their own Datasets I have to fill the dataset
each time the form pops up. In my example I am using a MS
AccessDatabase and it takes close to 3-5 seconds to fill the dataset.
Now I know that Access sucks and I should be using SQL, but to me this
is good test case for a far bigger "real" database.
Not to mention at this point I am now storing the entire database in
Memory in my App. Which wouldn't be entirly that bad if I wasn't doing
it multiple times for every form.
So my first Idea was to pass the filled dataset from the parent form to
the Child form, problem is I would have to update all the contol
bindings by hand. So I tried binding the Controls to a Dataview instead
of a Dataset and then setting the Dataview's Table to the Dataset Table
by hand, seems to work, but I am wondering if this may be a little
redundant.
The docs suggest building a component that handles your database access
for you. But how would you setup the binding on the controls in the
Designer with this configuration?
Any help or input would be appreciated. Thanks