Reputation: 3197
I have a strongly-typed dataset (VB.NET), using .NET Framework 2.0. Given a DataRow
in a parent DataTable
and a DataRelation
, I need to find all related rows in the child DataTable
that have a RowState
= DataRowState.Deleted
.
Unfortunately for me, DataRow.GetChildRows(DataRelation)
does not include child rows that have a RowState
of DataRowState.Deleted
.
Currently I'm doing a table scan of the child table to find the deleted rows that match the criteria of the relation, but my tables have become too large for that to work. How can I get the deleted child rows with decent performance?
Upvotes: 2
Views: 1985
Reputation: 3197
solved this by using GetChildRows(relation, DataRowVersion.Original)
. Then, iterate through those rows and grab the ones with RowState = DataRowState.Deleted
.
Upvotes: 1
Reputation: 4673
You can use DataSet.GetChanges and pass the DataRowState.Deleted parameter. It should return a DataSet that contains all the rows marked as deleted.
Upvotes: 2