Listing 1 Display all employees of the sales department using ADO.NET

String sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Samples\\Test.mdb";
OleDbConnection myConnection = new OleDbConnection(sConn);

string sSQLquery = "select * from Employee where DeptID = 'Sales'";

OleDbDataAdapter theAdapter = new OleDbDataAdapter(sSQLquery, sConn);
DataSet employeeData = new DataSet();
theAdapter.Fill(employeeData);

foreach (DataTable table in employeeData.Tables)
{
    foreach (DataRow row in table.Rows)
    {
	Console.WriteLine("Employee ID: " + row["EmpID"].ToString());
	Console.WriteLine("Name: " + row["Name"].ToString());
	Console.WriteLine("Address: " + row["Address"].ToString());
    }
}

Listing 2 Display all employees of the sales department using O/R mapped solution

// Instantiate the correct department..perform db call under the covers
Department dept = DepartmentFactory.FindByPrimaryKey("Sales");
// Get all employees associated with the sales department
IList employees = dept.employees;

for (int i = 0; i < employees.Count; i++) {
    Employee emp = (Employee) employees[i];

    Console.WriteLine("Employee ID: " + emp.ID);
    Console.WriteLine("Name: " + emp.Name);
    Console.WriteLine("Address: " + emp.Address);
}