D
Danny Liberty
Hi,
I'm building a relatively simple Windows Forms application that
supports displaying and editing of data from multiple RELATED tables.
To simplify my question, I'll supply an example:
The windows forms should display a store's sales data. The data is
divided into multiple tables: Sales, Customers and Inventory.
I built a dataset to represent the tables, and I used some bound
textboxes and grids to display the data. I also provided a data
navigator control to allow the user to switch between records.
What would be the best approach to fill and update the dataset for this
form?
The approach I took was to create one data adapter per table, then when
the form loads I fill the dataset by calling Fill() on all the data
adapters. This works just fine, but it's also very inefficient. Every
time the form loads, ALL the inventory and customers tables are loaded
into the dataset. I assume a better approach would be to fill the
dataset only with the data currently needed to display on the form. So
now I have to use BindingContext.PositionChanged and write some messy
code...
Must be a cleaner solution...anybody?
I'm building a relatively simple Windows Forms application that
supports displaying and editing of data from multiple RELATED tables.
To simplify my question, I'll supply an example:
The windows forms should display a store's sales data. The data is
divided into multiple tables: Sales, Customers and Inventory.
I built a dataset to represent the tables, and I used some bound
textboxes and grids to display the data. I also provided a data
navigator control to allow the user to switch between records.
What would be the best approach to fill and update the dataset for this
form?
The approach I took was to create one data adapter per table, then when
the form loads I fill the dataset by calling Fill() on all the data
adapters. This works just fine, but it's also very inefficient. Every
time the form loads, ALL the inventory and customers tables are loaded
into the dataset. I assume a better approach would be to fill the
dataset only with the data currently needed to display on the form. So
now I have to use BindingContext.PositionChanged and write some messy
code...
Must be a cleaner solution...anybody?