F
Frank Rizzo
I have an app that has to connect to various data sources (ms sql server,
sybase, etc...). For this reason I have OdbcConnection, OleDb Connection and
SqlClient objects. When an error happens, I want a single procedure to
handle the error from all the connection types by passing the either the
SqlException, OdbcException or OleDbException.
Unfortunately the object SystemException, that these exceptions have been
derived from, does not have the .Errors collection (like the SqlException,
OdbcException or OleDbException does), so when I pass SystemException into
the procedure and attempt to loop through the Errors collection, it
obviously complains that SystemException does not have such a collection.
Other than overloading the function for each type (which kind of defeats the
purpose of having a single function to handle data related exceptions), can
anyone suggest anything?
sybase, etc...). For this reason I have OdbcConnection, OleDb Connection and
SqlClient objects. When an error happens, I want a single procedure to
handle the error from all the connection types by passing the either the
SqlException, OdbcException or OleDbException.
Unfortunately the object SystemException, that these exceptions have been
derived from, does not have the .Errors collection (like the SqlException,
OdbcException or OleDbException does), so when I pass SystemException into
the procedure and attempt to loop through the Errors collection, it
obviously complains that SystemException does not have such a collection.
Other than overloading the function for each type (which kind of defeats the
purpose of having a single function to handle data related exceptions), can
anyone suggest anything?