Hi Dean,
Thank you for using MSDN Newsgroup! My name is Kevin, and I will be
assisting you on this issue.
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to merge data from several
DataSet with the same schema. Is there's any misunderstanding, please feel
free to point me out.
As Miha suggested in his post, DataSet.Merge method is a good choice to
achieve this. However, there's something that we have to pay attention to
during using this method.
If you're developing on a Typed DataSet, tables will have schema
information. They will have a primary key included in the schema. The
primary key is a unique identity which identifies a row from others. When
merging two DataSets with primary key, if there're two rows which has the
same primary key, they will be considered as the same row. So only one of
them can be persisted.
In this case, if there might be primary key conflict in the DataSets, the
best way is to use Untyped DataSet to achieve this. During the merge, we
should also set the MissingSchemaAction to MissingSchemaAction.Add. Here's
a short example about how to merge two DataSets.
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
this.sqlDataAdapter1.Fill(ds1,"Table1");
this.sqlDataAdapter1.Fill(ds2,"Table1");
ds1.Merge(ds2, true, MissingSchemaAction.Add);
For more information about how to use DataSet.Merge method, please refer to
the following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatasetclassmergetopic.asp
Does this answer your question? If anything is unclear, please feel free to
reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."