Refersing dataset

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can a dataset be refreshed with the data that may have been entered by
other users on the network? The dataset uses a dataadapter.

Thanks

Regards
 
Using the DataAdapter's Fill(DataSet) method will overwrite the entire
DataSet, clearing all changes. If you want to keep local changes, only
replacing Unmodified rows with the data on the server, then you need to
create a new DataSet and call the DataAdapter's Fill(DataSet) mehtod on that
new DataSet. The user the Merge(DataSet, true) method on the original
DataSet to merge in the updated data from the server (the 'true' as the
second argument makes the Merge "persist changes" otherwise Merge will have
the same effect as Fill, and overwrite all changes). Note: make sure you
have primary keys set up on your DataTables or the Merge method will make a
bunch of duplicate rows.

Hope this helps,
-Paul Wheeler
 
Yes, that works, what I said about the changes only applies if you want to
refresh from the server before saving any changes.
 
Back
Top