dataset merge

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have an original dataset. It is copied to 2 different forms. Each form
adds a new row to the same table in that dataset. When I merge these 2
dataset back to original one, the 2 new rows merge to one!
My question is how I can still keep them as 2 rows in that table, not merge
to one?

Thanks.

Li
 
Hi Li,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to merge the two DataSets with
to one and keep the additional rows in both DataSets. If there is any
misunderstanding, please feel free to let me know.

According to your description, I believe the DataSets are strong typed with
key information. So when merging, the two new added rows are recognized as
identical row and discard the changes in one DataSet you made.

So with the key information, it is impossible for us to merge the two
DataSets correctly using DataSet.Merge directly. However, you can try the
following steps for a walkaround.

1. Remove the primary key information in the destination DataSet.
2. Use DataSet.GetChanges(DataRowState.Added) to get the added rows in the
source DataSet.
3. Then use DataSet.Merge on the destination DataSet to merge data.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
You're welcome, Li.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top