VB.Net/Database ADO.net/DataTable

Материал из VB Эксперт
Перейти к: навигация, поиск

Obtain the DataTable of SQL Server instances

  
Imports System
Imports System.Data
Imports System.Data.Sql
    Public Class MainClass
        Public Shared Sub Main()
            Using sqlSources As DataTable = SqlDataSourceEnumerator.Instance.GetDataSources()
                For Each source As DataRow In sqlSources.Rows
                    Console.WriteLine(" Server Name:{0}", source("ServerName"))
                    Console.WriteLine(" Instance Name:{0}", source("InstanceName"))
                    Console.WriteLine(" Is Clustered:{0}", source("IsClustered"))
                    Console.WriteLine(" Version:{0}", source("Version"))
                    Console.WriteLine(Environment.NewLine)
                Next
            End Using
        End Sub
    End Class