Enumerating SQL Server instances on a network returns "nothing"?

  • Thread starter Thread starter roger.breton
  • Start date Start date
R

roger.breton

Guest
Hope I'm in the right forum to post this question.

I am trying to retrieve the names of SQL Server instances on my network. Microsoft documentation tells me this is how I should proceed:

' In order to retrieve the table containing information about the available SQL Server instances,
' you must first retrieve an enumerator, using the shared/static Instance property

Dim instance = System.Data.Sql.SqlDataSourceEnumerator.Instance

' Once you have retrieved the static instance, you can call the GetDataSources method,
' which returns a DataTable containing information about the available servers

Dim dataTable = instance.GetDataSources()
I can execute those two lines of code but the trouble is that the dataTable rows are = 0? In other words, my application has not succeeded in retrieving the names of any SQL Servers instances running on my network? Are there better ways to do this?

Continue reading...
 
Back
Top