How to force DataAdapter NOT to update added rows?

  • Thread starter Thread starter Dmitry Karneyev
  • Start date Start date
D

Dmitry Karneyev

Hi!
I've got a DataSet with tables corresponding to the database ones.
And I've got a table for my calculations and databinding in app.
To fill "my" table I use myTable.Rows.Add(...) and then edit necessary
columns.
When app closes I check dataset.HasChanges() and if it is I make an update.
But HasChanges always returns true because I've got added rows to "myTable".
How to avoid such situation? Or how to change status of "myTable" rows to
original?

Thanks!
 
Dmitry,

If possible, you will want to add all of the rows you need first and
then call AcceptChanges. This will have the effect of changing the state of
the rows to unchanged, and then you can perform your edits. The only change
in the tables will then be the edits, and HasChanges will give you the
result that you want.

Hope this helps.
 
Back
Top