7-Apr-07 (Created: 7-Apr-07) | More in 'CS-dotnet'

Getting Data from Oracle in asp.net

Start with a database definition

  <db name="odb">
    <connectString>User Id=SWN;Password=satya;Data Source=XE</connectString>
    <dataProviderType type="com.ai.db.generic.OracleDataProviderType,Aspire.Net"/>
  <dbalias name="odbalias" dbname="odb"/>


1. I have defined a database called "odb" pointing to my oracle database called XE

2. The XE name is defined in the tnsnames.ora file which indirectly points to the host name and the port number

3. The data provider class tells the driver to use, in this case oracle.

4. The dbalias allows a level of indirection

5. The defaultdbalias points to the default database to be used

Define a query called GetWells

  <request name="GetWells" 
    commandstring="select * from tab"


1. The c# class GenStoredProcExecutor is a general purpose class that can execute stored procs and sql statements to retrieve rows from a database.

Source code to execute

        static void testOracle()
            Hashtable parms = new Hashtable();
            ICollection rtn = (ICollection)AppServices.getObject("/request/getwells",parms);
            foreach (object o in rtn)
                Hashtable ht = (Hashtable)o;
                foreach (DictionaryEntry e in ht)