473,378 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Continuing execution after caught exception

Hi,

I have the following code:

for (int i=0;i<childOptimizations.Length;i++) //for each partition

{

row = childOptimizations[i];

if (i==0)

dataManager.UpdateAvailabilityWithLegsFromExisting Trips(System.Convert.ToInt
32(row["SCHOPT_ID"]));

else

dataManager.UpdateAvailabilityWithLegsFromExisting Optimization(System.Conver
t.ToInt32(previousRow["SCHOPT_ID"]),System.Convert.ToInt32(row["SCHOPT_ID"])
);

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

catch

{

}

childOptimizations=dataManager.SCHEDULE_OPTIMIZATI ON.Select("PARENT_SCHOPT_I
D="+optimizationID);

previousRow=childOptimizations[i];

}

Even though the optimizationEngine.optimize might thorw an exception, I
still want to the loop and run the other optimizations.

I know I can turn optimizationEngine.optimize method to return an error code
instead of throwing an exception, but I am baffled as to why I can't
continue the execution with optimizationEngine.optimize throwing an
exception.

Thanks


Jul 21 '05 #1
1 2030
Hi:

You should put the "optimizationEngine.optimize(.......);" inside another
nested try-catch block
Ex:

try
{
// Put here the code you have
// put this line into the nested try catch block
// optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));
try
{

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));
}
catch
{
// skip the exeption
}

// the program flow continues here, even when optimizationEngine.optimize
threw an exception
}
catch
{
}

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

"Tolga Erdogus" <to**********@alum.mit.edu> escribió en el mensaje
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have the following code:

for (int i=0;i<childOptimizations.Length;i++) //for each partition

{

row = childOptimizations[i];

if (i==0)

dataManager.UpdateAvailabilityWithLegsFromExisting Trips(System.Convert.ToInt 32(row["SCHOPT_ID"]));

else

dataManager.UpdateAvailabilityWithLegsFromExisting Optimization(System.Conver t.ToInt32(previousRow["SCHOPT_ID"]),System.Convert.ToInt32(row["SCHOPT_ID"]) );

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

catch

{

}

childOptimizations=dataManager.SCHEDULE_OPTIMIZATI ON.Select("PARENT_SCHOPT_I D="+optimizationID);

previousRow=childOptimizations[i];

}

Even though the optimizationEngine.optimize might thorw an exception, I
still want to the loop and run the other optimizations.

I know I can turn optimizationEngine.optimize method to return an error code instead of throwing an exception, but I am baffled as to why I can't
continue the execution with optimizationEngine.optimize throwing an
exception.

Thanks

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
Hello all, I know why the following doesn't work ... I can't figure out how to make it work like I want it to. Basically, I only want the loop computing fibonacci numbers to run for approx 5...
3
by: omission9 | last post by:
Any advice on the following would be much appreciated. I have thrown everything I have at it and am completely stumped. I apologize for the length, I have tried to be as succint as possible. I...
9
by: Joe Rigley | last post by:
Hello, As a .NET newbie I'd appreciate some advice... I've been tasked with writing a small app (in VB .NET) that takes some data from our HR system, does some format modifications, and loads...
2
by: James Cooke | last post by:
Hi all, I want to catch a duplicate key exception. I do not want to provide that verbose message from the MSSQL server - I would put a user friendly message out, like "The item you have added...
1
by: Tolga Erdogus | last post by:
Hi, I have the following code: for (int i=0;i<childOptimizations.Length;i++) //for each partition { row = childOptimizations;
3
by: RSH | last post by:
Hi, I have two questions both by a VB programmer that is learning C#... 1) In a VB error trap routine we would commonly trap the error and write it to an error log and then attempt to "Resume...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
6
by: daniel | last post by:
I use a simple program to illustrate the problem: import logging def foo() : raise ValueError("foo") if __name__ == "__main__" : try : foo()
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
in event log:.NET Runtime version 2.0.50727.312 - Fatal Execution Engine Error (7A062A61) (80131506) We have an application that seems to be throwing this error, but I can't seem to work out why...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.