This piece of code returns a collection of SQL Servers found on the local network.
Public Class clsSQLDMO
Public Function GetListOfSQLServers(ByRef colSQLServers As Collection) As Boolean
Dim iIndex As Integer
Dim oSQLServer As New SQLDMO.SQLServer()
Dim oServerList As SQLDMO.NameList = oSQLServer.Application.ListAvailableSQLServers
colSQLServers = New Collection()
For iIndex = 1 To oServerList.Count
colSQLServers.Add(oServerList.Item(iIndex).ToString)
Next
Return True
End Function
End Class
阅读(1139) | 评论(0) | 转发(0) |