Related rows within a typed dataset: How to make them work?

S

Sean F. Aitken

Good morning,

I have a typed dataset that is composed of a few tables. I usually just
use the typed dataset for loading / updating and working with data at
the table level (and not at the DataSet level). In other words, I
usually get DataTables using DataAdapters and update similarily.

I noticed recently that a strongly typed DataRow has a reference to the
related row in another table in the dataset. For instance, if I have
two related tables: TableA and TableB, then the typed rows "TableARow"
would have a property exposing the related row, "TableBRow". Navigating
that object shows that it is a DataRow for the related table.

My question is how do I get that related row to contain data? The
TableA datatable is being populated with a GetDataBy... method call.
My hunch is that the relationship is superficial, and no data will be
there, unless I take measures to fill the ENTIRE dataset... which is
far from ideal.

I'm struggling with where to find more information on this as well. If
anyone has any experience with related tables or related DataRows in
typed DataSets, any advice would be appreciated.

best regards,
-Sean
 
M

Miha Markic [MVP C#]

Hi Sean,

Sean F. Aitken said:
Good morning,

I have a typed dataset that is composed of a few tables. I usually just
use the typed dataset for loading / updating and working with data at
the table level (and not at the DataSet level). In other words, I
usually get DataTables using DataAdapters and update similarily.

I noticed recently that a strongly typed DataRow has a reference to the
related row in another table in the dataset. For instance, if I have
two related tables: TableA and TableB, then the typed rows "TableARow"
would have a property exposing the related row, "TableBRow". Navigating
that object shows that it is a DataRow for the related table.

My question is how do I get that related row to contain data? The
TableA datatable is being populated with a GetDataBy... method call.
My hunch is that the relationship is superficial, and no data will be
there, unless I take measures to fill the ENTIRE dataset... which is
far from ideal.

Right, but you don't have to fill entire dataset - just rows that you need.
I'm struggling with where to find more information on this as well. If
anyone has any experience with related tables or related DataRows in
typed DataSets, any advice would be appreciated.

You are stuck with loading all necessary data by yourself (either using an
adapter per table or an adapter that returns more recordsets).
 

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