Z
zacks
The help isn't clear on this. If I have multiple catches and the first
one catches the particular exception that was thrown, does it check the
rest of the catches in the try/catch?
For example, I want to execute a SQL command and if it times out I want
to warn the user and continue. If any other error occurs I want to
treat it as a "fatal" error,
Try
cmd = New SqlCommand("some sql code", connection)
cmd.CommandTimeout = 120
cmd.ExecuteNonQuery
Catch ex as TimeoutException
<warn the user that a timeout occured>
Catch ex as Exception
<log fatal error>
Exit Function
End Try
Or do I really need a Exit Try in the TimeoutException's Catch?
one catches the particular exception that was thrown, does it check the
rest of the catches in the try/catch?
For example, I want to execute a SQL command and if it times out I want
to warn the user and continue. If any other error occurs I want to
treat it as a "fatal" error,
Try
cmd = New SqlCommand("some sql code", connection)
cmd.CommandTimeout = 120
cmd.ExecuteNonQuery
Catch ex as TimeoutException
<warn the user that a timeout occured>
Catch ex as Exception
<log fatal error>
Exit Function
End Try
Or do I really need a Exit Try in the TimeoutException's Catch?