操作步骤:
1、DLL下载后并引用(这个DLL其实是Oracle为C#专门提供的,在它的官方也可以下载到 Oracle官网 )
下载地址:Oracle.ManagedDataAccess.zip
下载后,将Oracle.ManagedDataAccess.dll放到自己的项目中,然后引用
2、接调用(connString 改为自己的连接字符串)
using Oracle.ManagedDataAccess.Client; public static string ConnectOracle() { try { string connString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=130.147.246.144)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ECMS)));Persist Security Info=True;User ID=system;Password=Service01;"; OracleConnection con = new OracleConnection(connString); con.Open(); return string.Empty; } catch (Exception ex) { return ex.ToString(); } }
参照:
http://www.cnblogs.com/yjmyzz/archive/2013/11/01/3400999.html
http://www.cnblogs.com/ly303550688/archive/2013/01/31/2887104.html