Wednesday, 15 August 2012

Confirming a successful LINQ to SQL update -


I am using whether the following code is appropriate if I want to inform the sender that the database has been updated successfully Or is there a better way?

  try {dc.ModelA.InsertOnSubmit (modela); Dc.SubmitChanges (); Back true; } Hold {return false; }  

There is a better way to catch the exception and call it. By catching the exception, you are extracting all the information about why , failing to include, for somebody it is difficult to debug and fix the problem, then you need it :

  DC Model A. Insert onspit (model); Dc.SubmitChanges ();  

No comments:

Post a Comment