checking, operation successful after any LinqToSql operation
We normally use these statements to add anew record to database.
MyDataContext.InsertOnSubmit(AnObject);
MyDataContext.SubmitChanges();
Other than using stored proced开发者_如何学JAVAure(can return a value by "Return / Output"), is there a way to return a value indicating, operation was successful ? probably, Linq own methods / functions
Any idea, Thanks
If the operation is not successful, then it will throw an exception. If it doesn't throw an exception, then it was successful.
Couldn't use a try and catch block and trap the appropriate errors?
精彩评论