views:

107

answers:

1

Hi,

I'm using Updaterow_event handler for grid where in I update cells in the grid and therby gets updated in the datatable also...

I have a button which i click after updating cells in the grid so that inside button_click event i'm writing code to update in Database..

I've a problem here... I dont know how to access only those records(of datatble) which had update (as done in the grid) and need to be updated in Database....

Is there any simple way of doing tht !! ??

A: 

Using DataRowState with the DataRow Object The DataRow has a RowState property that can be viewed and filtered at any time and can be any of the following DataRow-State enumeration values:

Detached DataRow is created but not added to a DataTable.

Added DataRow is added to a DataTable.

Unchanged DataRow has not changed since the last call to the AcceptChanges method. The DataRow changes to this state when the AcceptChanges method is called.

Modified DataRow has been modified since the last time the AcceptChanges method was called. Deleted DataRow is deleted using the Delete method of the DataRow.


for details check these articles

http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate.aspx

http://www.fmsinc.com/free/NewTips/NET/NETtip56.asp

Muhammad Akhtar