Click to See Complete Forum and Search --> : Linq To SQL DeleteItem Problem


JonnyPoet
September 30th, 2008, 07:53 PM
Hi friends !
I'm just tryingto learn to use DeleteOnSubmit method in a Linq to sql database I want to delete brands which is no problem as long as the brandID isn't already used in a product in the product table. So if this is occuring then an error is thrown and the delete action cannot be done

In a normal sql 2005 table I would have done reject changes and all would be handled.

But in this new enviroment, I cannot get rid of the problem. After this happens I cannot add or delete or update any item before restarting the application because oviously if for example I want to add a new item the linq datbase on SubmitChanges at first again tries to delete the item which is obviously in a mode to be removed. So I cannot add anymore items nor delete the failed one.
Whats needed to be done to undo the effect of the DeleteOnSubmit method and to get the item out of 'the list of items to be removed '

There is no method like reject changes, So whats to do when this error occurs.

JonnyPoet
October 2nd, 2008, 07:11 AM
No one any idea ? What are the correct steps after getting an errormessage in deleting an item from a Linq to sql database enviroment ?