recently i am doing one development in that i need to do continuous the operations even systems throw error
like
try
{
while(i < = 5)
{
table.insert();
i++;
}
}
catch(Exception::error)
{
}
in this scenario while inserting first record system throws an unknown error but still i need to insert remaining records also then how can i do
You have to move your try/catch block to the while loop.
if i have another outer loop then how can i do
while()
{
try
{
while(i < = 5)
{
table.insert();
i++;
}
}
catch(Exception::error)
{
}
table2.insert();
}
my intention and my doubt is how to skip that error record
That you have another outer loop is irrelevant. You still have to do what I told you. Like this:
while (i <= 5)
{
try
{
// This block "tries" to insert a record
// … fill the buffer …
table.insert();
}
catch (Exception::Error)
{
// If error occurs, don't break the execution.
// You don't want to throw any exception from here,
// but you can add some logging, for example.
}
}
Please don’t forget to read through Exception Handling with try and catch Keywords on MSDN.
Thank you Martin for a valuable replies
If you got an answer, please mark the helpful reply (replies) as the verified solution. It will make clear that this thread is closed and what’s the solution.