' 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.OleDb

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 cmd As OleDbCommand = New OleDbCommand("SELECT COUNT(*) FROM T1", con)
        'Dim n As Integer = CType(cmd.ExecuteScalar, Integer)
        Dim n As Integer = cmd.ExecuteScalar
        Console.WriteLine(n)
        con.Close
    End Sub
End Class 
