on error - continue

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

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.
 
Back
Top