Home All Groups Group Topic Archive Search About

How-to? Handling exception with DatasetTableAdapter in ADO.NET 2

Author
23 Jan 2006 7:23 AM
Michael Wong
Hi,

I'm currently trying to code with the new C# ADO.NET 2 (I'm still new
and haven't done much coding in ADO.NET 1 yet)

I'm stuck trying out to figure how the exception handling works.

VStudio 2005 generates a TableAdapter which uses a DataAdapter internally.
I've read (for SqlDataAdapter) that to handle exceptions, we have a few
options:
- ContinueUpdateOnError
- RowUpdated event

Which are not available with the TableAdapter.

To simplify, I would be specific on deleting several rows in the dataset.

What should I do in case there is an exception when I update the
dataset, just after I have deleted a few rows from it (and no other
changes)?
How do you guys normaly handle this kind of situation?

Does the RowError still apply in this case?

Some of my thoughts:
1) SqlException, when the network connection is lost
2) InvalidOperationException,
3) DBConcurrencyException, which it seems to not work with rows deletion

Thank you

AddThis Social Bookmark Button