Updating hierarchical data

P

PontiMax

I'm working with the Northwind database
tables 'Customers', 'Orders', and 'Order
Details': 'CustomerID' relates 'Orders' to 'Customers',
and 'OrderID' relates 'Order Details' to 'Orders'. For
displaying this hierarchical data I create a DataSet,
append and fill a DataTable for each database table, and
finally set up two Relations.

Say, I want to bind the dataset to a flat (WebForms)
DataGrid where each row consists of the
columns 'CompanyName' (from
table 'Customers'), 'OrderDate' (from table 'Orders'),
and 'Quantity' (from table 'Order Details'). The grid
should be editable, i.e. each data modification should be
send back to the database.

Are there any guidelines for implementing this
efficiently? Is it possible to bind datagrid columns to
different DataTables (which in turn belong to the same
DataSet)? How can I retain the relationship between
columns and DataTable items?

Thanks in advance,
PontiMax
 
M

Miha Markic

Hi,

AFAIK you'll experience pain.
Basically, you have two options: Keep dataset like image of database or
flatten the tables.
In the first approach you'll have to deal with putting data into grid and
out of it while the other will keep you busy synchronizing data with
database.

Or you can combine both of them - read data into hierarhical one, flatten
the tables to flat dataset.
After editing, update the hierarhical grid with changes and fire the Update
mehtod.

The later seems the most easy to me.

Miha Markic - RightHand .NET consulting & software development
miha at rthand com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top