Solved

How to neglect exceptions?????????

Posted on 2008-10-25
1
222 Views
Last Modified: 2013-12-17
Hi Experts,

              In my code i am fetching some records from a table and doing some task on the fetched data in a loop. I am doing it in try catch block.

             Suppose 100 records are fetched by the query and processing is being done in a loop. now after processing suppose 20 records an exception occurs(SQL exception or any general exception due to wrong data in the record) while processing 21st. Then the execution of the loop will transfer to catch block. so next 80 records will  remain unprocessed.

            What I want is to continue the loop for processing next record instead of breaking it when exception occurs.

I am not sure it is possible or not. If it is then how to do it?


Thanx in advance.

Regards,
Paramhans
0
Comment
Question by:Paramhans
1 Comment
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 500 total points
ID: 22802065
add a try catch block inside the loop and ignore the exception there

for(...)
{
 try{
//your code goes here
}
catch
{
 continue;
}
}
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question