Get all connected Servers on a local network

  • Public Shared arr As New ArrayList()

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim dt As DataTable = SqlDataSourceEnumerator.Instance.GetDataSources

    cmb_Sources.Items.Insert(0, System.Net.Dns.GetHostName().ToString)
    For Each dr As DataRow In dt.Rows
    cmb_Sources.Items.Add(String.Concat(dr("ServerName"), "\", dr("InstanceName")))

    arr.Add(String.Concat(dr("ServerName"), "\", dr("InstanceName")))

    cmb_Sources.SelectedIndex = cmb_Sources.FindString(System.Net.Dns.GetHostName().ToString)
    End Sub

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week