ds.GetChanges

  • Thread starter Thread starter bic
  • Start date Start date
B

bic

The current CF doesn't support getChanges as in the full framework.

Doing an update to a dataset you can do

1. DA.Update(Ds)

or

2. DA.Update(DS.GetChanges) * Only in Full Framework.

Doing number 2 should be much faster if there are a lot of record
in the dataset. I am wondering how the CF Update the dataset.
Does it loop through all the rows in the dataset and check for rowstate
for delete/changed/added then updated to the database? If so.. I am
concern if I have several thousand records.. this can be a very slow process..
 
bic said:
The current CF doesn't support getChanges as in the full framework.

Doing an update to a dataset you can do

1. DA.Update(Ds)

or

2. DA.Update(DS.GetChanges) * Only in Full Framework.

Doing number 2 should be much faster if there are a lot of record
in the dataset. I am wondering how the CF Update the dataset.
Does it loop through all the rows in the dataset and check for rowstate
for delete/changed/added then updated to the database? If so.. I am
concern if I have several thousand records.. this can be a very slow process..

I don't see why it would be slower - after all *something's* got to go
through and find all the changed rows. Either that can be
DataAdapter.Update, or DataSet.GetChanges - either way, every record
needs to be looked at, but the database should only be used for the
changed rows.
 
I do not have performance data, but I suspect #2 will be slower.

In #1 da.Update(ds) loops through all records and updates changed ones.
In #2 ds.GetChanges() loops through all records and copy changed ones to
the new DataSet.
Next, da.Update() loops through all records in this new dataset and updates
changed ones (all of them in this case).

So, in case #2 you're doing useless copying of the data and loops though
changed records twice.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Back
Top