Multiple Catches in Try/Catch
- From: zacks@xxxxxxxxxxxxxxxxxxxxxxxx
- Date: 16 Jan 2006 09:16:02 -0800
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?
.
- Follow-Ups:
- Re: Multiple Catches in Try/Catch
- From: Herfried K. Wagner [MVP]
- Re: Multiple Catches in Try/Catch
- From: AMDRIT
- Re: Multiple Catches in Try/Catch
- From: Larry Lard
- Re: Multiple Catches in Try/Catch
- Prev by Date: Re: How do I extract a page from word and insert into a new word document using VB
- Next by Date: Re: Multiple Catches in Try/Catch
- Previous by thread: Scroll bar buttons
- Next by thread: Re: Multiple Catches in Try/Catch
- Index(es):