用 Devart
需要的dll:
Devart.Data.dll;Devart.Data.Oracle.dll
需要的许可:
licenses.licx
没有这个会报错:License not found. Please view "Licensing" topic in dotConnect for Oracle documentation for details or contact Devart technical support.
https://www.cnblogs.com/happyqiang/p/15887162.html
使用方法:
1:引用上面两个dll,把许可文件添加到工程Properties如下:
https://www.cnblogs.com/happyqiang/p/15887162.html
2:准备OracleHelper类 这个容易找,一搜一大把 改改就行
连接参数大致如下:
private static string orclstr = "User Id=xxxx;Password=xxxx;Server=1.2.3.4;Direct=True;Sid=ORCL;port=11111;";
测试连接:
/// <summary> /// 测试oracle连接是否能成功打开 /// </summary> /// <returns></returns> public static bool testopenoraclecon() { try { OracleConnection oracon = new OracleConnection(SQLClass.Connstr_Orcl); oracon.Open(); oracon.Close(); } catch (OracleException ex) { return false; } return true; }