方式1:直接利用.NET的oracle驱动连接
引用System.data.oracleclient;
1 using System.data.oracleclient;
2 string oradb = "Data Source=water;User Id=modis;Password=modis;Integrated Security=no";
3 OracleConnection conn = new OracleConnection(oradb);
4 conn.Open();
?
方式2:安装完ODP.net(Oracle Data Provider.NET),通过OLEDB连接。
引用System.Data.OleDb;
1 using System.Data.OleDb;
2 string oradb = "Provider=OraOLEDB.Oracle;Data Source=water;User Id=modis;Password=modis;";
3 OleDbConnection myConnection = new OleDbConnection(oradb);
4 myConnection.Open();
?
方式3:安装完ODP.net,通过Oracle的连接器
引用动态链接库Oracle.DataAccess.Client.
1 using Oracle.DataAccess.Client;
2 string oradb = "Data Source=water;User Id=modis;Password=modis;";
3 OracleConnection conn = new OracleConnection(oradb); // C#
4 conn.Open();