zoukankan      html  css  js  c++  java
  • .NET 连接Oracl 数据库

    .NET程序连接Oracle的几种方式:

    1,OracleConnection:

        string connstr = "Provider=OraOleDb.Oracle;DataSource=orcl;userid=system;password=a123;";
                string cmdstr = "select * from test";
                OracleConnection orclcon = new OracleConnection("User Id=system;Password=a123;Data Source=orcl;");


                try
                {
                    orclcon.Open();
                    OracleCommand orclcmd = new OracleCommand(cmdstr, orclcon);
                    OracleDataAdapter oda = new OracleDataAdapter(orclcmd);
                    DataSet ds = new DataSet();
                    oda.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0];
                  
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

      PETSHOP连接字符串:Data Source=orcl;user id=MSPETSHOP4;password=pass@word1;min pool size=4;max pool size=4;

    2,OleDbConnection

  • 相关阅读:
    python面向对象编程(1)——基本概念,术语,self,构造器
    django-中间件
    集合
    深入字典
    django使用小贴士
    自动化发送微信
    django-模板继承
    SMTP发送邮件
    git的使用
    django-csrf攻击
  • 原文地址:https://www.cnblogs.com/netact/p/2038658.html
Copyright © 2011-2022 走看看