Deleted a row! Where is the Data?

This is a very common necessity for all the geeks out there using the dataset. I needed to access the data in a row marked as “Deleted“ in a DataSet. This resulted in a DeletedRowInaccessibleException exception. It is not possible to access the current information for a data row once the row has been deleted. Now this is what I call a tricky situation.
However, the very notion that there is 'current' data is a clue to the solution. Specify the version of the data to be retrieved, and it should be possible to get the original data. This you do it through the indexer on a DataRow. While the normal access mechanism for a DataRow would be

row[”ColumnName”]


to retrieve the original data in a deleted row, the desired version must be specified, as seen here

row[”ColumnName”, DataRowVersion.Original]

0 comments: