Solved

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

Posted on 2008-10-25
1
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio npm 1 39
IDE for Python 5 104
how to check mis-spellings in a select SQL 2 52
How do I "share" on social sites? 2 38
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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