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

Class MainClass
    Public Shared Sub Main(ByVal args As String())
        Dim con As SqlConnection = New SqlConnection ("server=DKARNE\DKARNE;Integrated Security=SSPI;database=master")
        con.Open
        Dim cmd As SqlCommand = New SqlCommand ("sp_databases", con)
        cmd.CommandType = CommandType.StoredProcedure
        Dim rdr As SqlDataReader = cmd.ExecuteReader
        While rdr.Read
            Dim dbnam As String = CType(rdr(0), String)
            Console.WriteLine("Database=" + dbnam)
        End While
        con.Close
    End Sub
End Class 
