Solved

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

Posted on 2008-10-25
1
217 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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 …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now