Reputation: 5182
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 = "General 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!
Upvotes: 0
Views: 2652
Reputation: 138776
The ODP.NET's OracleException
class has a Number
property that should contain the Oracle specific error number: OracleException's Number Property
Upvotes: 1
Reputation: 33242
Check the Code
/ErrorCode
properties of OracleException in order to see if you can use them for discriminating the specific error.
Upvotes: 3