Tuesday, October 16, 2012

Accessing deleted row field values from data table with C#.net


Accessing deleted row field values from data table with C#.net

Solution #1

Sometimes we delete data row in data table of dataset. Then we may need again to get deleted row field information from the dataset back for some calculation purpose. It gives error if we want to access the row data from the data table telling "The data row has been deleted ...".

We can still access the field data information by using DataRowVersion.Original parameter. For example 

int customerId = Convert.ToInt32( DataTable1.Rows[0][0, DataRowVersion.Original];

This will give the original version of the row data. And voila - we have our original data back.

Solution #2


We can make a Data View out of the datatable. Then convert that data view into data table again. This will give us the original data. But this time the datarowstate = "added".

We see one example code for this.

DataView myView = new DataView(sourceTable, null, null,DataViewRowState.Deleted);DataTable myTable = myView.ToTable();

Continuous Integration for .net Core projects ( for beginners )

Hello developers, This article is about how you can easily setup continuous integration for your dot net core (dnx) projects with appveyo...