Refersing dataset

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
 
P

Paul Wheeler

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
 
J

John

Can I not save changes in my dataset to the server first and then use fill?

Regards
 
P

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top