码迷,mamicode.com
首页 > 数据库 > 详细

在ado.net中实现oracle存储过程调用两种方式

时间:2017-03-08 14:00:07      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:arch   ati   input   rac   ext   log   parameter   his   open   

 

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();

 

在ado.net中实现oracle存储过程调用两种方式

标签:arch   ati   input   rac   ext   log   parameter   his   open   

原文地址:http://www.cnblogs.com/senyier/p/6518614.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!