Question

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?

Was it helpful?

Solution 2

solved this by using GetChildRows(relation, DataRowVersion.Original). Then, iterate through those rows and grab the ones with RowState = DataRowState.Deleted.

OTHER TIPS

You can use DataSet.GetChanges and pass the DataRowState.Deleted parameter. It should return a DataSet that contains all the rows marked as deleted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top