How to rollback the datacontext to the point of the last submitchanges?

Edit Alternatively, you could make use of the DataContext. Transaction, and use that to Commit() or Rollback() your changes ORIG Just throw away that DataContext & Re-instantiate it Something like public void MyMethod(string connStr) { try { DataClasses1DataContext dc = new DataClasses1DataContext(connStr); for (int I = 0; I.

Edit Alternatively, you could make use of the DataContext. Transaction, and use that to .Commit() or .Rollback() your changes. ORIG Just throw away that DataContext & Re-instantiate it.

Something like... public void MyMethod(string connStr) { try { DataClasses1DataContext dc = new DataClasses1DataContext(connStr); for (int I = 0; I.

You could also use the TransactionScope in a using statement. If you don't call .Complete() on the TransactionScope, all changes are rolled back when it is disposed (which happens when leaving the using statement).

But at a certain point when an error occurs I want all the changes to the DataContext be disgarded and "thrown away". So that after an error I have a clean copy of the DataContext that matches the state of the database.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions