Skip to content

Instantly share code, notes, and snippets.

@deostroll
Created July 5, 2016 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deostroll/e4cc8f998cf8da037fae0e16d1e0f4f6 to your computer and use it in GitHub Desktop.
Save deostroll/e4cc8f998cf8da037fae0e16d1e0f4f6 to your computer and use it in GitHub Desktop.
oracle odp.net sample
using Oracle.ManagedDataAccess.Client;
using System;
namespace caODP.net
{
class Program
{
static void Main(string[] args)
{
OracleConnection cxn = new OracleConnection();
cxn.ConnectionString = Properties.Settings.Default.ConnectionString;
cxn.Open();
var cmd = cxn.CreateCommand();
cmd.CommandText = "Select * from users";
cmd.CommandType = System.Data.CommandType.Text;
var rdr = cmd.ExecuteReader(System.Data.CommandBehavior.Default);
//Console.WriteLine("Has Rows: {0}", rdr.HasRows);
while (rdr.Read())
{
Console.WriteLine("id: {0}, name: {1}", rdr[0], rdr[1]);
}
cxn.Close();
Console.WriteLine("End");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment