# OLE Database connection a loop through row C#.NET

**URL:** <https://forums.thehomestack.io/t/ole-database-connection-a-loop-through-row-c-net/213>\
**Category:** vb.Net\
**Created:** [March 12, 2005, 5:31pm UTC](https://forums.thehomestack.io/t/ole-database-connection-a-loop-through-row-c-net/213 "2005-03-12T17:31:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [March 12, 2005, 5:31pm UTC](https://forums.thehomestack.io/t/ole-database-connection-a-loop-through-row-c-net/213/1 "2005-03-12T17:31:51Z")

</div>

```auto

// set up the connection
OleDbConnection myConn = new OleDbConnection ( 
   "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + 
   Server.MapPath ( "~/shared/data/dbtutor.mdb" ) );

// set up the query
OleDbDataAdapter myCmd = new OleDbDataAdapter ( 
   "select * from Products", myConn );

// initialize dataset object
DataSet myData = new DataSet ( );
// fill with query results
myCmd.Fill ( myData, "Products" );

// display dataset contents
foreach ( DataTable table in myData.Tables ) {
   foreach ( DataRow row in table.Rows ) {
      foreach ( DataColumn col in table.Columns ) {
         Response.Write ( row [col].ToString ( ) );
      }
   }
}

```
