1. 程式人生 > >c#調用存儲過程

c#調用存儲過程

clas protect con prot arch class varchar close onf

創建表

create table test
(ID number,
NAME varchar2(10),
SEX varchar2(4),
AGE number,
ADDRESS varchar2(200)
);

創建不帶參的存儲過程

create or replace procedure proc1
is
begin insert into test(ID,NAME,SEX,AGE) values
(1,moses,man,25);
commit;
end;

c#調用存儲過程

protected void Button2_Click(object sender, EventArgs e)
    {
        String oc 
= ConfigurationManager.ConnectionStrings["conn"].ToString(); OracleConnection conn = new OracleConnection(oc); conn.Open(); OracleCommand orm = conn.CreateCommand(); orm.CommandType = CommandType.StoredProcedure; orm.CommandText = "proc1"; orm.ExecuteNonQuery(); conn.
Close(); }

c#調用存儲過程