Tech Junkie Blog - Real World Tutorials, Happy Coding!: C# Querying From An Oracle Database

Thursday, September 5, 2013

C# Querying From An Oracle Database

In this blog we will go over how to query an Oracle database in ASP.NET using the System.Data.OracleClient data provider in C#.


using System.Web.Configuration;
using System.Data.OracleClient;
using System.Data;

            string cs = WebConfigurationManager.ConnectionStrings["SomeConnectionString"].ConnectionString;

            using (OracleConnection oc = new OracleConnection(cs))
                DataTable dt = new DataTable(); 
                OracleCommand ocmd = new OracleCommand("SELECT * FROM SOMETABLE", oc);
                OracleDataAdapter oda = new OracleDataAdapter(ocmd);


                GridView1.DataSource = dt;

Previous: Oracle Date Format And Compare

1 comment:

Search This Blog