PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Related rows within a typed dataset: How to make them work?

Reply

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

 
Thread Tools Rate Thread
Old 14-09-2006, 02:22 PM   #1
Sean F. Aitken
Guest
 
Posts: n/a
Default Related rows within a typed dataset: How to make them work?


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

  Reply With Quote
Old 16-09-2006, 08:31 AM   #2
Miha Markic [MVP C#]
Guest
 
Posts: n/a
Default Re: Related rows within a typed dataset: How to make them work?

Hi Sean,

"Sean F. Aitken" <sean.aitken@gmail.com> wrote in message
news:1158240163.809926.205500@d34g2000cwd.googlegroups.com...
> 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).

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off