ADO .NET OUT变量Oracle 10G与11G

时间:2015-09-06 17:02:19

标签: c# .net oracle oracle11g ado.net

问题: 不会返回程序中的OUT变量。

背景: 我最近更新了Oracle 10g到Oracle 11G的应用程序。我们正在使用12c版本的Oracle客户端。

该应用程序在.NET 3.5上运行。

Database db = CreateDatabase(connectionName);
            var dbCmd = db.GetStoredProcCommand(procedureName);

            ConvertParams(ref dbCmd, parameters);

            try
            {
                iReturn = db.ExecuteNonQuery(dbCmd, _transaction);
                if (transaction == null) //if a transaction hasn't been passed, it isn't intended to has control over commit/rollback out of method, so app can do it
                    _transaction.Commit();
            }
            catch (Exception ex)
            {
                if (transaction == null)
                    _transaction.Rollback();
                throw ex;
            }
            finally
            {
                DebugSpCommand(procedureName, parameters);
                GetOutputParams(ref parameters, dbCmd);
                if (transaction == null)
                {
                    if (_transaction.Connection != null)
                        _transaction.Connection.Close();
                    _transaction.Dispose();
                }
            }
        }
        catch (OracleException ex)
        {
            Framework.ErrorHandling.ErrorHandler.HandleException(ex, "DATA_LAYER_POLICY");
            Framework.Logging.Logger.Write(ex.Message, LogCategories.Debug);
            iReturn = ex.Code;
        }
        catch (Exception ex)
        {
            Framework.ErrorHandling.ErrorHandler.HandleException(ex, "DATA_LAYER_POLICY");
            Framework.Logging.Logger.Write(ex.Message, LogCategories.Debug);
        }

1 个答案:

答案 0 :(得分:0)

您可以在存储过程中使用输出