Two DataSet Updates

  • Thread starter Thread starter SMG
  • Start date Start date
S

SMG

Hi there,
I have a dataset in memory, which is filled with 1000 records.

If the records are changed in the database, I want to reflect the changes to
the previous records that means:

Dataset 1 : Table 1 [In memory]

Id Name ReportID
1 Shailesh 001
2 gajare 002
3 Gauri 0045
4 Ravi 0009
5 Rajan 5009

After some XX duration I fire a query to database which has followings
records:

Id Name ReportID
1 New_record 01025 - New record
2 gajare 0022 - Modified record
3 Ravi 0009

Two records are deleted [Rajan, Shailesh], One is newly added by values [1
New_record 01025], and one is modified[2 gajare
0022].
Two records are not modified [ Gauri, Ravi]

I want the final dataset as follows:

Id Name ReportID
1 New_record 01025 - New record
2 gajare 0022 - Modified record
3 Gauri 0045 - same record
4 Ravi 0009 - same record


What way I can achieve this?

Thanks and regards,
Shailesh Gajare
 
Two solutions.
I suppose ID is primary key.

-Use dataapdater Object to fill the dataset. Fill method of dataapdater add
or update current record in dataset. Only condition: Table must have primary
key.

-Second solution is to do it manually.
 
"SMG" wrote in message

Hi

Why don't you just flush the dataset and repopulate it with your query
results. Or is the query just returning the changed records?

Plus if you are deleting rows how are you going to reflect this back through
a query? I might have missed the point here slightly!! But using ADO.NET and
a strongly typed dataset this sort of thing has been implemented lots of
times.

Ian
 
Back
Top