Hi Jurson.
The GetChanges() Method of the DataTable iterates through all rows of
the DataTable. Since you have used DataTable.Remove(dr); there are no
rows in the collection and GetChanges() returns null.
You should use the Deleted() method of the row instead, as Cor already
said. This is because the row will only be marked as deleted, but not
removed immediately. In fact, it will be removed from the collection as
soon as you call DataTable.AcceptChanges();
DataRow.Remove(); will call AcceptChanges() for this row and will not
add itself to the deleted rows collection of the Table.
If you remove a row and you have a reference to it, you can get the
RowState, which will be *detached*.
dt.Rows.Remove(dr);
dr.RowState <- this will be detached.
but dr will no longer be in dt.
Kind regards
Alex
- Alexander Rauser
http://www.flashshop.info
jurson wrote:
> Hello,
>
> I remove row from DataTable. It works ok, the row is removed from
> collection. It should be marked as 'detached'. Am I right?
>
> Then I try to retrieve 'detached' rows using the code shown below.
> _currentEntryBE.Tables["EntryList"].Rows.Remove(dr);
>
> DataTable dt =
> _currentEntryBE.Tables["EntryList"].GetChanges(System.Data.DataRowState.Detached);
>
>
> I always get "null".
>
> Is there any other way to retrieve 'detached' rows from DataTable.
>
> jurson