[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

rodchar

3/20/2007 8:20:00 PM

hey all,
i have 2 lines of code inside my try block. they both divide to 2 variables.
if the first line fails it appears that the second line doesn't run at all.
is this true? and if so, is there a way to tell it to run the 2nd line anyway?

thanks,
rodchar
3 Answers

Aaron [SQL Server MVP]

3/20/2007 8:29:00 PM

0

When you encounter an error inside TRY, you move to CATCH. That is the
purpose.

Maybe you should read Erland's articles on error handling? They're very
elaborate and should answer all the questions you have today and all the
questions you might come up with tomorrow.

http://www.sommarskog.se/error-handl...
http://www.sommarskog.se/error-handli...

--
Aaron Bertrand
SQL Server MVP
http://www.sq...
http://www.aspfa...


> i have 2 lines of code inside my try block. they both divide to 2
> variables.
> if the first line fails it appears that the second line doesn't run at
> all.
> is this true? and if so, is there a way to tell it to run the 2nd line
> anyway?


EMartinez

3/21/2007 3:20:00 AM

0

On Mar 20, 3:28 pm, "Aaron Bertrand [SQL Server MVP]"
<ten....@dnartreb.noraa> wrote:
> When you encounter an error inside TRY, you move to CATCH. That is the
> purpose.
>
> Maybe you should read Erland's articles on error handling? They're very
> elaborate and should answer all the questions you have today and all the
> questions you might come up with tomorrow.
>
> http://www.sommarskog.se/error-handling-I.htmlhttp://www.sommarskog.se/error-handli...
>
> --
> Aaron Bertrand
> SQL Server MVPhttp://www.sqlblog.com/http://www.aspfa...
>
>
>
>
>
> > i have 2 lines of code inside my try block. they both divide to 2
> > variables.
> > if the first line fails it appears that the second line doesn't run at
> > all.
> > is this true? and if so, is there a way to tell it to run the 2nd line
> > anyway?

The only way around this handling would be to execute the query in a
windows application, if going through the extra trouble is worth the
time.

Regards,

Enrique Martinez
Sr. SQL Server Developer

rodchar

3/21/2007 12:43:00 PM

0

thanks everyone for the feedback.

"rodchar" wrote:

> hey all,
> i have 2 lines of code inside my try block. they both divide to 2 variables.
> if the first line fails it appears that the second line doesn't run at all.
> is this true? and if so, is there a way to tell it to run the 2nd line anyway?
>
> thanks,
> rodchar