Friday, March 16, 2012

on error - continue

in a Try/Catch block - once an error is thrown, is there any way to set it
so that it will continue through the rest of the procedure?
(in the catch block, I'm firing off an email with the error message)Not sure what you mean.Continue?
Let say, If you can not open SQL connection is there any sense to attempt to
run SQL statement?
you have control how to continue by placing your TRY/CATCH statements.
Example
string sNumber = Request["id"];
int iNum = 0;
try
{
iNum = Int32.Parse(sNumber);
}
catch(Exception e)
{
..SEND EMAIL...
}
...continue here...
Print( iNum)
After you caught exception your application will continue. It will just
print 0 if sNumber was not an integer.
So by placing try/catch correctly you can tell compiler what to skip and
what to not.
George.
"Elmo Watson" <sm@.here.com> wrote in message
news:ex%23x60mPIHA.4584@.TK2MSFTNGP03.phx.gbl...
> in a Try/Catch block - once an error is thrown, is there any way to set it
> so that it will continue through the rest of the procedure?
> (in the catch block, I'm firing off an email with the error message)
>
>

0 comments:

Post a Comment