You need to import SQLDMO in your project. The following function adds the
list of servers to a combo box - cboServers and returns the count:
Imports SQLDMO
.....
Private Function LoadSQLServerList() As Integer
Dim serverIndex As Integer
Dim sqlServers As SQLDMO.NameList
Dim sqlServer As Object
' Get a list of servers
sqlServers = New SQLDMO.Application().ListAvailableSQLServers()
' Iterate through the server names, and add it to the combobox
For Each sqlServer In sqlServers
If Not sqlServer Is Nothing Then
cboServers.Items.Add(sqlServer)
End If
Next
' Send back the count of servers
LoadSQLServerList = cboServers.Items.Count
End Function
Hope that helps.
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"EvanK" <an*******@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
Is there a way to access a list of available sql servers in vb and make a
dropdown list?