Created
July 5, 2016 11:32
-
-
Save deostroll/e4cc8f998cf8da037fae0e16d1e0f4f6 to your computer and use it in GitHub Desktop.
oracle odp.net sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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