c#调用存储过程

2021-03-30 05:26

阅读:1336

标签:mos   ext   store   command   exe   RoCE   arc   acl   char   

创建表

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#调用存储过程

标签:mos   ext   store   command   exe   RoCE   arc   acl   char   

原文地址:https://www.cnblogs.com/bsdbqling/p/9282985.html


评论


亲,登录后才可以留言!