Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

smoapplication.enumavailablesqlservers network problem

Status
Not open for further replies.

ttdobj

Technical User
Sep 30, 2002
63
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top