Make it so your Dialog is a dumb UI. I. E, it handles all of the input of the data, but doesn't persist any data.So if you are using a dialog called from a form - have something like If (myDlg.ShowDialog() = DialogResult.
Ok) MyDataContext.SubmitChanges() End If This way, if your dialog doesn't return Ok (i.e. If they click cancel, the DataContext won't persist the results bak to the database This makes for reusable code as well.
Make it so your Dialog is a dumb UI. I. E, it handles all of the input of the data, but doesn't persist any data.So if you are using a dialog called from a form - have something like If (myDlg.ShowDialog() = DialogResult.
Ok) MyDataContext.SubmitChanges() End If This way, if your dialog doesn't return Ok (i.e. If they click cancel, the DataContext won't persist the results bak to the database. This makes for reusable code as well.
It's a good way I didn't know befor but my data is not in a dialog but in a user control. So thanks – Garcia Julien Apr 3 '10 at 4:03.
If you don't call . SubmitChanges on the DataContext then the changes will not be applied to the database. It's all about the DataContext when considering the change tracking of your entities.
If you would like to clear all changes, then close the datacontext and open a new one.
Yes but th eproblem is not the insert in the DB. The problem is that I wnat when you hit Cancel Button all changes is discarded. – Garcia Julien Apr 3 '10 at 4:05 I know that the ChangeSet can be retrieved by using DataContext.
GetChangeSet, but I am not sure if the deletes, updates or inserts can be modified. In your situation I would look at options for applying any changes outside of the linq entities and only applying them when the changes are actually required to be made. – SteadyEddi Apr 3 '10 at 9:23.
Thanks for your response, I found a solution, I reload the datacontext when I hit cancel. It's working and it's faster. Thanks.
I would like to know if its possible to discard changes of only one record of only one table in datacontext. I use databind to bind my controls on a form. I modify one record at a time.
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.