Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
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 …

749 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