on error - continue

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)
 
G

George Ter-Saakov

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top