471,330 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

How to sync-up DataSet during multi-table update

PV
When performing a parent-child table updates using DataAdapters, the
updates have to be performed in at least two passes. The deletes must
be done child first, then parent. Conversely, the inserts must be done
parent first, then child. This is generally accomplished by using
DataSet.GetChanges(DataRowState.Deleted) and
DataSet.GetChanges(DataRowState.Inserted) respectively.

My question is: What is the best way after this to sync up the
original DataSet with what was actually done by the database stored
procedure? For example, if a primary key was generated for the
inserted data?

When you update the source DataSet directly, the DataAdapter (at least
SqlDataAdapter) automatically updates the temporary primary keys with
the new primary keys.

I have tried to use DataSet.Merge, but that does not update the
original rows - it just appends the inserts so that now I have twice as
many new rows.

What is the best practice?

Jul 22 '05 #1
1 1868
PV
No responses yet? Where are all the MS gurus? Certainly this must be
a common problem.

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jake Jessup | last post: by
1 post views Thread by kartik | last post: by
2 posts views Thread by M.L. | last post: by
7 posts views Thread by BarryS | last post: by
7 posts views Thread by john | last post: by
2 posts views Thread by Jorge | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.