' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.Data
Imports System.Data.OleDb

Namespace E
    Class MainClass
        Public Shared Sub Main(ByVal args As String())
            Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Databases\MSAccess\Test.mdb;")
            con.Open
            Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT f1,f2 FROM t1", con)
            Dim ds As DataSet = New DataSet
            da.Fill(ds, "t1")
            For Each dt As DataTable In ds.Tables
                Console.WriteLine(dt.TableName + ":")
                For Each dr As DataRow In dt.Rows
                    For Each o As Object In dr.ItemArray
                     Console.Write(" " & o)
                    Next
                    Console.WriteLine
                Next
            Next
            Console.WriteLine(ds.Tables("t1").Rows(1)("f2"))
            con.Close
        End Sub
    End Class 
End Namespace
