We are attempting to retrieve a list of available SQL servers on the network and locally.
It works fine if the PC we are running on is connected to the network, such that the smo objects retrieve network and local SQL servers.
But if we disconnect the network, the smo objects fail to retrieve network, but more bizarrely/importantly fail also to retrieve any local SQL Server.
The code is:
------------------------------
Public Function GetAvailableServers() As DataView
Dim AvailableServersList As New DataTable("SQLServers")
'do the retrieve of the server list
AvailableServersList = SmoApplication.EnumAvailableSqlServers(False)
If AvailableServersList.Rows.Count = 0 Then
AvailableServersList = SmoApplication.EnumAvailableSqlServers(True)
End If
' Now sort the returned server list.
Dim AvailableServersDataView As New DataView(AvailableServersList)
AvailableServersDataView.Sort = "Name ASC"
'Return AvailableServersList
Return AvailableServersDataView
End Function
-----------------------------------------
and it doesn't work.
Any help with this would be appreciated.
ta
John
It works fine if the PC we are running on is connected to the network, such that the smo objects retrieve network and local SQL servers.
But if we disconnect the network, the smo objects fail to retrieve network, but more bizarrely/importantly fail also to retrieve any local SQL Server.
The code is:
------------------------------
Public Function GetAvailableServers() As DataView
Dim AvailableServersList As New DataTable("SQLServers")
'do the retrieve of the server list
AvailableServersList = SmoApplication.EnumAvailableSqlServers(False)
If AvailableServersList.Rows.Count = 0 Then
AvailableServersList = SmoApplication.EnumAvailableSqlServers(True)
End If
' Now sort the returned server list.
Dim AvailableServersDataView As New DataView(AvailableServersList)
AvailableServersDataView.Sort = "Name ASC"
'Return AvailableServersList
Return AvailableServersDataView
End Function
-----------------------------------------
and it doesn't work.
Any help with this would be appreciated.
ta
John