日期:2014-05-16 浏览次数:21119 次
[url=http://www.cnblogs.com/zwq194/archive/2010/07/12/1775646.html]C#调用Oracle存储过程的方法 [img=http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/16.gif][/img][/url] create or replace procedure proc2 ( v_id number, v_name varchar2 ) is begin insert into test(id,name) values(v_id,v_name); commit; end; OracleConnection conn = new OracleConnection("server=cw;uid=ls0019999;pwd=aaaaaa"); conn.Open(); OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "proc2"; cmd.Parameters.Add("v_id", OracleType.Number).Direction = ParameterDirection.Input;//指明传入的参数是输入给oracle存储过程用的 cmd.Parameters["v_id"].Value =this.textBox1.Text.Trim(); cmd.Parameters.Add("v_name",OracleType.NVarChar).Direction = ParameterDirection.Input;//指明传入的参数是输入给oracle存储过程用的 cmd.Parameters["v_name"].Value =this.textBox2.Text.Trim(); cmd.ExecuteNonQuery(); conn.Close();