Oracle.ManagedDataAccess.Client code example

Example: c# Oracle.ManagedDataAccess.dll select

// C#
using System;
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.Types;
 
namespace Connect
{
  class Program
  {
    static void Main(string[] args)
    {
      try
      {
        // Please replace the connection string attribute settings
        string constr = "user id=scott;password=tiger;data source=oracle";
 
        OracleConnection con = new OracleConnection(constr);
        con.Open();
        Console.WriteLine("Connected to Oracle Database {0}", con.ServerVersion);
        con.Dispose();
 
        Console.WriteLine("Press RETURN to exit.");
        Console.ReadLine();
      }
      catch (Exception ex)
      {
        Console.WriteLine("Error : {0}", ex);
      }
    }
  }
}