Does anyone know best practices (i.e. a tried and true method) for
this problem? I want to re-attempt an operation which caused on
exception, and do so an arbitrary number of times. For example, I
want to try connecting to a database multiple times before giving
up.
I have a solution (in C#), but I suspect it's not the best way to do
it :
RETRY:
try
{
dbAdapter.Fill( dataSetToFill,
statementCriter ia.TableName);
}
catch (System.Data.Od bc.OdbcExceptio n dbe)
{
x++;
if (x>max)
{
throw new DMTException("* ************* ODBC
Error >>>" + x.ToString(), dbe);
}
else
{
goto RETRY;
}
}
This seems to work, but I'm using goto,
which is never a good idea.
Any suggestions?
*---------------------------------*
Posted at: http://www.GroupSrv.com
Check: http://wwww.HotCodecs.com
*---------------------------------*
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
this problem? I want to re-attempt an operation which caused on
exception, and do so an arbitrary number of times. For example, I
want to try connecting to a database multiple times before giving
up.
I have a solution (in C#), but I suspect it's not the best way to do
it :
RETRY:
try
{
dbAdapter.Fill( dataSetToFill,
statementCriter ia.TableName);
}
catch (System.Data.Od bc.OdbcExceptio n dbe)
{
x++;
if (x>max)
{
throw new DMTException("* ************* ODBC
Error >>>" + x.ToString(), dbe);
}
else
{
goto RETRY;
}
}
This seems to work, but I'm using goto,
which is never a good idea.
Any suggestions?
*---------------------------------*
Posted at: http://www.GroupSrv.com
Check: http://wwww.HotCodecs.com
*---------------------------------*
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
Comment