一、取得局域網所有可用的SQL Server的實例
Dim i As Integer
''Use the SQL DMO object to find available SQL Servers
Dim obJSQLServerAPP As SQLDMO.Application
''Use the SQL DMO Application Object to find the available SQL Servers
Set obJSQLServerAPP = New SQLDMO.Application
Dim namX As NameList
Set namX = obJSQLServerAPP.ListAvailableSQLServers
For i = 1 To namX.Count
txtServer.AddItem namX.Item(i)
Next