连接oracle(不需要下载其他程序,只引用一个dll)

OracleConnection con = new OracleConnection(@"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XXX)));Persist Security Info=True;User ID=XXX;Password=XXX;");
try
{
    con.Open();
    OracleCommand cmd = new OracleCommand("SELECT * from BS_DIC_FORM_VERSION where IS_DELETE = '1'", con);
    OracleDataAdapter ada = new OracleDataAdapter(cmd);
    DataSet ds = new DataSet();
    ada.Fill(ds);
    System.Data.DataTable table = ds.Tables[0] as System.Data.DataTable;
    return table;
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
finally
{
    con.Close();
}

文件地址:https://files.cnblogs.com/files/chenjiachuan/Oracle.ManagedDataAccess.zip

猜你喜欢

转载自www.cnblogs.com/chenjiachuan/p/9365133.html