[英]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: 我在C#应用程序中使用ODP.NET,并且正在使用以下代码执行存储过程:
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. odp.net似乎只有OracleException,而没有OracleTimeoutException或类似的东西。
Thank you! 谢谢!
检查OracleException的Code
/ ErrorCode
属性,以查看是否可以使用它们来区分特定错误。
ODP.NET的OracleException
类具有Number
属性,该属性应包含Oracle特定的错误号: OracleException的Number属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.