Oracle ODP.NET Timeout exception
I'm using ODP.NET in an c# application, and i'm using the following code to execute a stored procedure:
OracleCommand _cmd = new OracleCommand();
try
{
_cmd.CommandTimeout = 900;
_cmd.Connection = myConnection;
_cmd.CommandType = CommandType.StoredProcedure;
_cmd.CommandText = storedProcedureName;
_cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
DisplayAnyway = true;
ImportMessage = "Genera开发者_如何学Cl problem occured\n" + ex.Message;
ex.ToString();
}
My question is, how could i modify this in order to be able to do some special stuff only when a timeout exception occurs. The odp.net seems to have only a OracleException and no OracleTimeoutException or somthing like this.
Thank you!
Check the Code
/ErrorCode
properties of OracleException in order to see if you can use them for discriminating the specific error.
The ODP.NET's OracleException
class has a Number
property that should contain the Oracle specific error number: OracleException's Number Property
精彩评论