Merge datasets

  • Thread starter Thread starter Miro
  • Start date Start date
M

Miro

Why isn't this working?

I have a strongly typed DataSet and VS.NET-created
DataAdapter. I create a new DataSet and add some Data:

myStronglyTypedDataset updates = new
myStronglyTypedDataset();
myStronglyTypedDataset.aTABLERow aRow =
updates.aTABLE.NewaTABLERow();
aRow["Col1"] = "value1";
aRow["Col2"] = "value2";
updates.aTABLE.Rows.Add(aRow);

I cannot update the Data-source directly cause this will
create duplicates, so I try to merge the updates with the
existing Data:

myDataAdapter.Fill(originDataset);
originDataSet.Merge(updates);
myDataAdapter.Update(originDataSet);

No Data is added/changed.

How can this be solved?

/Miro
 
Hi Miro
Is originDataset an Instance of myStronglyTypedDataset ? If they are
then there shouuld not be any problem . Can you Put a Break point after
you Merge and see the Number of rows in your DataTable . I suspect
Adapter.Update is Failing and so you are not seeing any change ?

You can also view MSDN documentation for more Help
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatasetclassmergetopic2.asp

Thanks
Sunder
 
Back
Top