.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

相关文章:

  • 2021-09-18
  • 2021-11-02
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-18
  • 2022-12-23
  • 2021-11-13
  • 2021-06-23
  • 2021-06-18
  • 2021-06-14
  • 2021-06-11
相关资源
相似解决方案