标签:结果 each tar dbn close version can return varchar
/// <summary> /// 执行数据库包体操作,返回结果 /// </summary> /// <param name="cmdText">包体函数或存储过程</param> /// <param name="commandParameters">参数集合</param> /// <returns></returns> public static int ExecuteNonQuery_package(string cmdText,string canshu) { int result; OracleConnection conn = new OracleConnection(connstr); OracleCommand cmd = conn.CreateCommand(); try { OracleParameter[] parameters = { new OracleParameter("返回参数",OracleDbType.Int32,1,ParameterDirection.ReturnValue,true,0,0,"",DataRowVersion.Default,Convert.DBNull), new OracleParameter("参数名与数据库一致",OracleDbType.Varchar2,100) }; parameters[1].Value = canshu; cmd.CommandText = cmdText; cmd.CommandType = CommandType.StoredProcedure; foreach (OracleParameter param in parameters) cmd.Parameters.Add(param); conn.Open(); cmd.ExecuteNonQuery(); var aaa = parameters[0].Value.ToString(); result= Convert.ToInt32(aaa); } catch (Exception) { throw; } finally { cmd.Dispose(); conn.Close(); conn.Dispose(); } return result; }
标签:结果 each tar dbn close version can return varchar
原文地址:https://www.cnblogs.com/uftwkb24/p/9636101.html