* Oracle Data Provider
"Data Source=tnsname;User ID=userid;Password=password"
using System; using System.Data; using System.Data.OracleClient; public class Test { public static void Main (string[] args) { string connectionString = "Data Source=testdb;" + "User ID=scott;" + "Password=tiger;"; OracleConnection dbcon = null; dbcon = new OracleConnection (connectionString); dbcon.Open (); OracleCommand dbcmd = dbcon.CreateCommand (); string sql = "SELECT ename, job FROM scott.emp"; dbcmd.CommandText = sql; OracleDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { string employeeName = (string) reader["ename"]; string job = (string) reader["job"]; Console.WriteLine ("Employee Name: {0} Job: {1}", employeeName, job); } // clean up reader.Close (); reader = null; dbcmd.CommandText = sql; dbcmd.ExecuteNonQuery (); dbcmd.Dispose (); dbcmd = null; dbcon.Close (); dbcon = null; } }
mcs TestExample.cs -r System.Data.dll \ -r System.Data.OracleClient.dll
mcs TestExample.cs /r:System.Data.dll \ /r:System.Data.OracleClient.dll
mono TestExample.exe