Dataset Problem

  • Thread starter Thread starter Robert Clark
  • Start date Start date
R

Robert Clark

I have a simple windows app. It consists of 2 forms. The first is used to
view the contents of a dataset, the second is used to update the dataset and
add/remove items from it. The problem is, when i add or remove items from
the dataset, it doesn't update the dataset until i restart the application.
 
There is hardly enough information in your post to grasp what you
actually are doing to view and update your dataset besides the
statement that you have "2 forms". Nor do you specify where the dataset
came from or whether you are performing database updates.

But typically, assuming you just want to redisplay a DataGrid with the
updated dataset, you would

1) call AcceptChanges on the dataset.
2) Rebind the Control that is displaying your data, e.g.
myDataGrid.DataSource=myUpdatedDataset.Tables[0];

Again, this ignores whatever requirements you may have to update the
source Database, in which

case you would not call AcceptChanges first, you would use a
DataAdapter and use its Update method first,
then step 2 above.
 
Back
Top