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 LoadSQLServerLi st() As Integer
Dim serverIndex As Integer
Dim sqlServers As SQLDMO.NameList
Dim sqlServer As Object
' Get a list of servers
sqlServers = New SQLDMO.Applicat ion().ListAvail ableSQLServers( )
' Iterate through the server names, and add it to the combobox
For Each sqlServer In sqlServers
If Not sqlServer Is Nothing Then
cboServers.Item s.Add(sqlServer )
End If
Next
' Send back the count of servers
LoadSQLServerLi st = cboServers.Item s.Count
End Function
Hope that helps.
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"EvanK" <an*******@disc ussions.microso ft.com> wrote in message
news:F6******** *************** ***********@mic rosoft.com...
Is there a way to access a list of available sql servers in vb and make a
dropdown list?