Re: About DataAdapter.Update by Christopher
Christopher
Sat Oct 25 19:00:57 CDT 2003
Hi Brad,
The DataSet does not compare the current with the previous, it keeps track
over all the changes performed.
Each DataRow in a DataTable has a RowState property that tells if the row
has been Added, Deleted etc.
This state is used to determine what the DataAdapter should do with the row.
If you delete all the DataRows, they will all be marked as deleted. If you
then rebuild the table, the rows are marked as added. When the DataAdapter
updates the datasource, all the previous rows will be deleted, and the new
ones added.
Note that when using the Fill method of the DataAdapter, the RowState is not
set to Added, it indicates Unchanged.
The RowState can be changed by using the AcceptChanges and RejectChanges
methods.
Hopes this helps.
Chris
"bhuff" <anonymous@discussions.microsoft.com> wrote in message
news:011301c39a53$9fb099e0$a401280a@phx.gbl...
> The dataadapter compares the current dataset with the
> original dataset in determining the series of
> INSERT,DELETE and UPDATE to make the datasource reflect
> the current dataset. What about the case when tables in
> a dataset is cleared and then rebuilt. Does the
> dataadapter send a DELETE removing the corresponding
> datasource or it is "smarter" and affects only changes
> between "before" and "after" of the dataset.
>
> Brad