日期:2012-05-16  浏览次数:20372 次

 

Oracle方面
1.创建Oracle过程存储
create or replace procedure proce_test(paramin in varchar2,paramout out varchar2,paraminout in out varchar2)
as
  varparam varchar2(28);
begin
  varparam:=paramin;
  paramout:=varparam|| paraminout; 
end;
2.测试过程存储
declare
  param_out varchar2(28);
  param_inout varchar2(28);
begin
  param_inout:='ff';  
  proce_test('dd',param_out,param_inout);  
  dbms_output.put_line(param_out);
end;

C#方面
引用Oracle组件
using System;
using System.Data;
using System.Data.OracleClient;   

namespace WebApplication4
{
     public class OraOprater
     {
         private OracleConnection conn=null;
         private OracleCommand cmd=null;
         public OraOprater()
         {
              string mConn="data source=ora9i.ora.com;user id=ora;password=ora";  //连接数据库
              conn=new OracleConnection(mConn);
              try
              {
                   conn.Open();
                   cmd=new OracleCommand();
                   cmd.Connection=conn;
              }
              catch(Exception e)
              {
                   throw e;
              }
         }

         public string SpExeFor(string m_A,string m_B)
         {
                //存储过程的参数声明
              OracleParameter[] parameters={
                                 new OracleParameter("paramin",OracleType.VarChar,20),
                                new OracleParameter("paramout",OracleType.VarChar,20),
                                 new OracleParameter("paraminout",OracleType.VarChar,20)
                                                };