* "bill salkin" <an*******@discussions.microsoft.com> scripsit:
I setup a "Try..." block and attempted to open a non-
existant database. It went to the second "catch" not the
first. What is the proper "catch" clause for this specific
case?
[...] try
conn.open ' will generate an error
...
Catch ex As InvalidOperationException
..
Catch ex As Exception
end try
Have a look at the documentation for the connection's 'Open' method you
use ('OleDbConnection', 'SqlConnection', OdbcConnection, ...).
The docs say:
'OleDbConnection'
'InvalidOperationException' if connection already open,
'OleDbException' for errors in the connection level.
'SqlConnection'
See: <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlconnectionclassopentopi c.asp>
'OdbcConnection'
See: <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdataodbcodbcconnectionclassopentopic.as p>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>