Hi,
In one of the module, we need to handle Connection Timeout exception. But there are no such exceptions available, so we are using GetType() of the exception to display appropriate message that Connection Timeout has occurred.
We tested it on Oracle, the e.InnerException.GetType() gives typeof(System.Data.Odbc.OdbcException). But when we use the same code on SQL server, the innerexception returns null and e.GetType() returns typeof(System.Exception). So how to handle this timeout exception for different databases?
Thanx,
Prasahnt
In one of the module, we need to handle Connection Timeout exception. But there are no such exceptions available, so we are using GetType() of the exception to display appropriate message that Connection Timeout has occurred.
Code:
catch (Exception e)
{
if (e.GetType() == typeof(System.Data.Odbc.OdbcException))
{
ErrMsg = "Timeout Exception";
}
}
Thanx,
Prasahnt