zoukankan      html  css  js  c++  java
  • c#连接oracle数据库

    连接字符串

    public static string connString = "User ID=DatabaseName;Password=OraclePwd;Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = IPAddress)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))";

    引用命名空间

    using Oracle.ManagedDataAccess.Client;

    连接方法

    public int GetConn()
    {
    OracleConnection conn = new OracleConnection(connString);
    int result = 0;
    try
    {
    conn.Open();
    result = 1;
    }
    catch (Exception ex)
    {
    throw (ex);
    }
    finally
    {
    conn.Close();
    }
    return result;
    }

    在其他地方就可以调用这个方法使用了

  • 相关阅读:
    SQL补充
    SQL练习题
    HDU 2907
    Codeforces 814D
    Codeforces 814C
    Codeforces 1004D
    Codeforces 1004E
    CodeForces 909F
    CodeForces 909E
    CodeForces 909D
  • 原文地址:https://www.cnblogs.com/missheyo/p/10106751.html
Copyright © 2011-2022 走看看