I have this code on two identical machines, named DEVONE and DEVTWO. Both on
the network. It works on DEVONE, finding (local) and DEVONE and populates
the combo box with them, but does not find any server(s) on DEVTWO, putting
<No Servers Found> in the combo box. Can anyone shed any light.
Code below:
Private Sub GetSQLServers()
Dim i As Integer
Dim sqlApp As New SQLDMO.ApplicationClass
Dim sqlServers As SQLDMO.NameList = sqlApp.ListAvailableSQLServers()
For i = 0 To sqlServers.Count - 1
Dim srv As Object = sqlServers.Item(i + 1)
If Not IsNothing(srv) Then
Me.cboRelevantServer.Items.Add(srv)
Me.cboMainServer.Items.Add(srv)
End If
Next
If Me.cboRelevantServer.Items.Count > 0 Then
Me.cboRelevantServer.SelectedIndex = 0
Else
Me.cboRelevantServer.Text = "<No Servers Found>"
End If
End Sub
Thanks,
Michael