Hello ADO.NET gurus :)

I am fairly new to database work and am hoping someone can help me
with a DataRelation question.

Anyway, I am working with an orders database. I have a DataTable of
orders, and another DataTable of order details, and need to get new
orders into my database.

I was able to set up a DataRelation between the two tables, however I
have an unfortunate limitation: I need to add the new orders and their
details in the same database transaction. (This is due to the
limitations of my database, which is proprietary and not relational.)
Therefore I can't follow David Sceppa's recommendation of first adding
the order and then updating the line items.

I think the best solution would be to pull in the details table when I
update the master (or vice versa), but I'm not sure if this is
possible. Is it? The other alternative I see is to maintain a cache,
have the details table update to this cache, and then pull in the
cache when you update the master table. However, I'd rather avoid this
for a variety of reasons.

Can anyone offer some suggestions?

Thank you!

Mike Milner

Re: DataRelation - update parent and child at same time? by Miha

Miha
Thu Jul 08 15:35:54 CDT 2004

Hi Mike,

Add a rows to dataset tables, then call Update of orders adapapter and then
Update of details adapter.
When adapters are properly configured it should just work if you have only
new or updated rows.
However, when you have also deleted rows there are more steps.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Mike Milner" <mikemilner2000@yahoo.com> wrote in message
news:771308d2.0407080925.9e7bf56@posting.google.com...
> Hello ADO.NET gurus :)
>
> I am fairly new to database work and am hoping someone can help me
> with a DataRelation question.
>
> Anyway, I am working with an orders database. I have a DataTable of
> orders, and another DataTable of order details, and need to get new
> orders into my database.
>
> I was able to set up a DataRelation between the two tables, however I
> have an unfortunate limitation: I need to add the new orders and their
> details in the same database transaction. (This is due to the
> limitations of my database, which is proprietary and not relational.)
> Therefore I can't follow David Sceppa's recommendation of first adding
> the order and then updating the line items.
>
> I think the best solution would be to pull in the details table when I
> update the master (or vice versa), but I'm not sure if this is
> possible. Is it? The other alternative I see is to maintain a cache,
> have the details table update to this cache, and then pull in the
> cache when you update the master table. However, I'd rather avoid this
> for a variety of reasons.
>
> Can anyone offer some suggestions?
>
> Thank you!
>
> Mike Milner