Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: Data Source synchronization


Message #1 by zliecho@h... on Wed, 3 Apr 2002 14:31:23
I want DataSet to be synchronized with data source. It means if some other 
program changes table in Access then I need to synchronize DataSet. My 
idea was polling data source by calling Fill method.

But I am missing:
- deleted records are still in DataSet after calling Fill method again!
- I do not know what changes have been done - the best would be having 
something last GetChanges() DataSet of updated operations - I need it for 
my presentation layer where I would like to populate just changes

Do you know how to solve those 2 problems?
Thanks,
Dalibor
Message #2 by "Michael Bednarz" <bednarz23@m...> on Fri, 12 Apr 2002 10:23:02
> I want DataSet to be synchronized with data source. It means if some 
other 
p> rogram changes table in Access then I need to synchronize DataSet. My 
i> dea was polling data source by calling Fill method.

> But I am missing:
->  deleted records are still in DataSet after calling Fill method again!
->  I do not know what changes have been done - the best would be having 
s> omething last GetChanges() DataSet of updated operations - I need it 
for 
m> y presentation layer where I would like to populate just changes

> Do you know how to solve those 2 problems?
T> hanks,
D> alibor

A dataset is a local in-memory copy of your data.  When you call the fill 
method on the DataAdapter you are filling a dataset with the records from 
the original datasource. Any changes made to the dataset from that point , 
the DataRowState gets updated on that particular row(s).  You can put 
records marked for deletion into a new dataset and then process accordingly

If dsOrigionalData.HasChanges(DataRowState.Deleted) Then
         Dim dsDeletedDataSet As DataSet
         dsDeletedDataSet = dsData.GetChanges(DataRowState.Deleted)
         'Delete records in database
Else
    'No records were marked for deletion
End if

Mike

  Return to Index