时间:2021-07-01 10:21:17 帮助过:4人阅读
ORAC.OracleParameter pram1 = new ORAC.OracleParameter("p1",ORAC.OracleType.VarChar,10);
pram1.Value = "test";
cmd.Parameters.Add(pram1);
ORAC.OracleParameter pram2 = new ORAC.OracleParameter("p2",ORAC.OracleType.VarChar,10);
pram2.Direction =ParameterDirection.Output;
cmd.Parameters.Add(pram2);
if(this.oracleConnection1.State == System.Data.ConnectionState.Closed)
{
this.oracleConnection1.Open();
}
cmd.ExecuteNonQuery();
this.textBox1.Text = cmd.Parameters[1].Value.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
this.oracleConnection1.Close();
}
}
参数说明
parameter.Value=赋值
当这个值为null时,不能直接赋值,负责页面就会报错:未将对象应用到对象的实例
当为null时需转化为System.DBNull.Value即可
调用Oracle存储过程并获取out参数值
标签: