您的位置:68399皇家赌场 > 集群主机 > C#通过奥莱Db查询Oracle存款和储蓄进程

C#通过奥莱Db查询Oracle存款和储蓄进程

发布时间:2019-05-03 22:06编辑:集群主机浏览(157)

    using System;
    using System.Data;
    using System.Data.OleDb;
    

    皇家赌场,  

            /// <summary>
            /// 通过OleDb查询Oracle存储过程
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            public static DataTable getTodoList(string id)
            {
                string connString1 = "provider=OraOLEDB.Oracle.1;User ID=test;Password=test;Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)));Persist Security Info=True;Extended Properties='PLSQLRSet=1';";//'PLSQLRSet=1'很重要
    
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                OleDbConnection conn = new OleDbConnection(connString1);
                OleDbCommand cmd = new OleDbCommand("getTodoList", conn);
                cmd.CommandType = CommandType.StoredProcedure;
    
                try
                {
                    conn.Open();
    
                    OleDbParameter[] parms = {
                                             new OleDbParameter("id1", OleDbType  .VarChar)
                                         };
                    parms[0].Value = id;
                    parms[0].Direction = ParameterDirection.Input;
                    foreach (OleDbParameter parm in parms)
                    {
                        cmd.Parameters.Add(parm);
                    }
    
                    OleDbDataAdapter oda = new OleDbDataAdapter(cmd);
    
                    oda.Fill(ds);
    
                }
                catch (Exception ex)
                {
    
                }
                finally
                {
                    cmd.Dispose();
                    conn.Close();
                }
    
                return ds.Tables[0];
            }
    

      

    本文由68399皇家赌场发布于集群主机,转载请注明出处:C#通过奥莱Db查询Oracle存款和储蓄进程

    关键词: 68399皇家赌场

上一篇:Selenium(五)——webdriver 之操作页面成分

下一篇:没有了