Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing datarow information from deleted datarow

Status
Not open for further replies.

dgerdner

Programmer
Mar 30, 2005
41
US
I have a datagrid bound to a datatable, and allow the user to make changes to the data in the grid. When the choose to "Save" changes I assumed I could loop through the datatable, and make database calls based on the DataRowState.

This works find for Inserts and Updates, but when I try to get the primary key column on a Deleted row, I receive this error:

"Deleted row information cannot be accessed through the row"

Certainly this is a common methodology. How can I get information on a delted datarow?
 
You have to specify DataRowVersion.Original if the row is deleted:
Code:
dr["Column1", DataRowVersion.Original].ToString();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top