时间:2021-07-01 10:21:17 帮助过:32人阅读
c#调用代码如下:
代码如下:
string strConn = “data source=clientag;user id=ay_plan;password=ayplan”; //连接数据库
conn = new OracleConnection(strConn);
try
{
conn.Open();
cmd = new OracleCommand();
cmd.Connection = conn;
}
catch (Exception e)
{
throw e;
}
OracleParameter[] parameters ={
new OracleParameter(“paramin”,OracleType.VarChar,20),
new OracleParameter(“paramout”,OracleType.VarChar,20),
new OracleParameter(“paraminout”,OracleType.VarChar,20)
};
parameters[0].Value = “bjd”;
parameters[2].Value = “cs”;
parameters[0].Direction = ParameterDirection.Input;
parameters[1].Direction = ParameterDirection.Output;
parameters[2].Direction = ParameterDirection.InputOutput;
try
{
cmd.CommandText = “proce_test”;//声明存储过程名
cmd.CommandType = CommandType.StoredProcedure;
foreach (OracleParameter parameter in parameters)
{
cmd.Parameters.Add(parameter);
}
cmd.ExecuteNonQuery();//执行存储过程
Console.WriteLine(parameters[1].Value.ToString());
Console.Read();
}
catch (Exception e)
{
throw e;
}
C#调用Oracle存储过程的方法
标签:word pad like .exe none script user pointer 委托