0

Is there any way in C# to check if the datatable values are changed or not from the time it is loaded from DB ? But I know we can check the DataRowState to identify it. But here I want to avoid or neglect a particular column when checking the DataRowState for a DataRow. Simple code is shown here.

      foreach (DataRow dr in DataTable.Rows)
        {
            if (dr.RowState != DataRowState.Unchanged)
            {
               // code
            }
        }

When checking the DataRowState for a DataRow, how can i neglect or avoid a column and check all the values of the other columns in the DataRow ?

Something like as shown below :

 // avoid Status column value and consider all other column values in the row.
 foreach (DataRow dr in DataTable.Rows.Where(not Status column))  
   {
     if (dr.RowState != DataRowState.Unchanged)
       {
         // code
       }
   }
James
  • 461
  • 1
  • 5
  • 8

1 Answers1

0

You can get all record that chenged with this code:

DataSet changedRecords = dataSet1.GetChanges();
  • Thanks for the reply. But this will consider "Status" column also. But I want to avoid Status column value change. Is there any way ? – James Nov 17 '13 at 07:49
  • see this:http://stackoverflow.com/questions/9084153/disable-datatable-change-tracking –  Nov 17 '13 at 07:52