i have this code and i was wondering if this is the right way to use try-catch phrase.
private void Save_URight()
{
try
{
if (Program.cnn.State == ConnectionState.Closed) { Program.cnn.Open(); }
'do some stuf
}
catch (OleDbException ex)
{
'error and exit'
return;
}
'do some stuff'
try
{
'do some stuff here'
try
{
'then do some other stuff'
try
{
'another try-catch'
}
catch (OleDbException ex)
{
'error msg.'
return;
}
}
catch (OleDbException ex)
{
'another catch and exit'
return;
}
}
catch (OleDbException ex)
{
'catch again'
}
}
more important is i always catch OleDBExceptions because i only use this to save data in the database, can i make a 1 catch not using 3 of them.
any clarification and help will be much appreciated
This post has been edited by NoBrain: 10 September 2010 - 05:22 AM

New Topic/Question
Reply



MultiQuote









|