In C# I have a DataTable that has been modified several times, where some rows are deleted, some rows are updated, some rows remain the same.
DataTable detailsTable = GetDdetails();
Insert code that does the following:
Sorts my
DataTableaccording to specific column (myColumn ASC) based on current values in the rows (current values accessible throughdetailsTable.Rows[i]["ColumnName", DataRowVersion.Original])Preserves original data in the rows, because both, original and current values are used later in
UseDetailsfunction (values accessible throughdetailsTable.Rows[i]["ColumnName", DataRowVersion.Current])
Code:
UseDetails(detailsTable);
I encountered a few problems:
Traditional way to sort values creates view from the
detailsTable, which will not bring deleted rows in.Specifically including deleted fields (using filters) will remove their deleted status.
Copying data from an unsorted table to sorted will throw an exception if attempting to access deleted field
Thank you in advance