views:

93

answers:

2

Can anyone share a link to sample (ASP).Net code that uses the new Oracle Data Provider.Net library?

I have code a web application code that uses the System.Data.OracleClient classes and want to migrate to the new Oracle Data Provider for .Net.

Thanks

+1  A: 

There is no real difference in how they are used, unless you are doing weird stuff with In/Out parameters or cursors.

The difference that you would see in your code is that the namespace will change to Oracle.DataAccess. I believe that most of the type-names stayed the same.

John Gietzen
+1  A: 

Your code might look as any standard ADO.NET code and you will be using an OracleConnection:

var connectionString = "Data Source=ORCL;User Id=user;Password=pwd;";

using (var conn = new OracleConnection(connectionString))
using (var cmd = conn.CreateCommand())
{
    conn.Open(); 
    cmd.CommandText = "SELECT name FROM mytable";
    using (var reader = cmd.ExecuteReader())
    {
        while (reader.Read())
        {
            string name = reader.GetString(0);
            // TODO: process the results here
        }
    }
}
Darin Dimitrov