c# 获取 oracle 变量值,C# 获取 oracle 存储过程输出参数值

public bool QueueToRegister(string appointsId, string enrolDoctor)

{

using (OleDbConnection conn = new OleDbConnection(DBHelper.Instance.ConnectionStr))

{

conn.Open();

OleDbCommand cmd = conn.CreateCommand();

try

{

//插入号源属性

cmd.CommandType = CommandType.StoredProcedure;

cmd.CommandText = "PROC_APPOINTTOENROL";

cmd.Parameters.Add("@p_APPOINTSID", OleDbType.VarChar).Value = appointsId;

cmd.Parameters.Add("@p_ENROLDOCTOR", OleDbType.VarChar).Value = enrolDoctor;

cmd.Parameters.Add("@p_IsUseCallCode", OleDbType.VarChar).Value = PubVariable.Instance.IsUseCallCode;

cmd.Parameters.Add("@p_AreaName", OleDbType.VarChar).Value = PubVariable.Instance.AreaName;

cmd.Parameters.Add("@p_result", OleDbType.Integer).Value = -1;

cmd.Parameters["@p_result"].Direction = ParameterDirection.InputOutput;

if (cmd.ExecuteNonQuery() > 0)

{

var aa = cmd.Parameters["@p_result"].Value.ToString();

return true;

}

}

catch { return false; }

finally

{

if (conn.State != ConnectionState.Closed) conn.Close();

}

}

return false;

}

using (OleDbConnection conn = new OleDbConnection(str))

{

OleDbTransaction tran = null;

conn.Open();

OleDbCommand cmd = conn.CreateCommand();

tran = conn.BeginTransaction(IsolationLevel.ReadCommitted);

cmd.Transaction = tran;

try

{

//插入号源属性

cmd.CommandType = CommandType.StoredProcedure;

cmd.CommandText = "PROC_APPOINTTOENROL";

cmd.Parameters.Add("@p_APPOINTSID", OleDbType.VarChar).Value = appointsId;

cmd.Parameters.Add("@p_ENROLDOCTOR", OleDbType.VarChar).Value = enrolDoctor;

cmd.Parameters.Add("@p_IsUseCallCode", OleDbType.VarChar).Value = isUseCallCode;

cmd.Parameters.Add("@p_AreaName", OleDbType.VarChar).Value = areaName;

cmd.Parameters.Add("@p_result", OleDbType.Integer).Value = -1;

cmd.Parameters["@p_result"].Direction = ParameterDirection.InputOutput;

if (cmd.ExecuteNonQuery() > 0)

{

string result = cmd.Parameters["@p_result"].Value.ToString();

log.WriteLogs("QueueToRegister return p_result:", "返回结果:", result);

if (result.Trim() != "1") return false;

tran.Commit();

log.WriteLogs("执行QueueToRegister:", "执行成功", ofdepart);

return true;

}

}

catch (Exception ex)

{

tran.Rollback();

log.WriteLogs("执行QueueToRegister:", "异常", ex.ToString());

return false;

}

finally

{

if (conn.State != ConnectionState.Closed) conn.Close();

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值