using System; using System.Data; using System.Data.OracleClient; namespace ConnectionToOracle ... { class Program ...{ static void Main(string[] args) ...{ OracleBDUtility oracle = new OracleBDUtility(); oracle.getData(); } } public class OracleBDUtility ...{ OracleConnection Conn = new OracleConnection("server=joe;user id=scott;password=tiger"); public void getData() ...{ Conn.Open(); OracleCommand cmd = Conn.CreateCommand(); cmd.CommandText = "select ename,job from scott.emp where job is not null"; OracleDataReader odr = cmd.ExecuteReader(); while (odr.Read()) ...{ Console.WriteLine("{0}--{1}", odr.GetValue(0), odr.GetValue(1)); } odr.Close(); Conn.Close(); } }}