1、常规的存储过程调用
String or=ConfigurationManager.ConnectionStrings["conn"].ToString(); OracleConnection oc = new OracleConnection(or); oc.Open(); OracleCommand om = oc.CreateCommand(); om.CommandType = CommandType.StoredProcedure; om.CommandText = "proc2"; om.Parameters.Add("v_id", OracleType.Number).Direction = ParameterDirection.Input; om.Parameters["v_id"].Value = this.TextBox2.Text.Trim(); om.Parameters.Add("v_name", OracleType.NVarChar).Direction = ParameterDirection.Input; om.Parameters["v_name"].Value = this.TextBox3.Text.Trim(); om.ExecuteNonQuery(); oc.Close();
2、调用无返回值存储过程
String or=ConfigurationManager.ConnectionStrings["conn"].ToString(); OracleConnection oc = new OracleConnection(or); oc.Open(); OracleCommand om = oc.CreateCommand(); om.CommandType = CommandType.Text; om.CommandText = "call PRO_USER_BOSS(a,b,c)";//a,b,c为传入的存储过程参数及值
om.ExecuteNonQuery(); oc.Close();