0

How do you verify that SubmitChanges() worked for inserts and updates? The method doesn't return a bool or int value.

burnt1ce
  • 14,387
  • 33
  • 102
  • 162

1 Answers1

1

If an insert fails it will throw a SqlException. I think it may do the same for failed updates.

jrummell
  • 42,637
  • 17
  • 112
  • 171
  • I guess i'll just wrap the call with a try and catch – burnt1ce Sep 25 '09 at 18:06
  • Throwing an exception on error is typically recommended over returning a boolean or affected row count. So I would recommend only catching the exception if you can do something about it (like log and rethrow). – jrummell Sep 25 '09 at 18:49