Finding MS SQL Servers on a network...

BoghRD
11-15-2000, 03:49 PM
Howdy,

I am resigned to managing database opens via a custom 'common dialog box', however, to make life easier for my customer base I am looking for the function(s) that return a list of Microsoft SQL Servers available on a local area network. I know there is one because quite a few products that use SQL Server (including SQL Server) seem to have code that fills a combo box with the proper server names. I think one of you told me where to look, but I cannot find reference to that conversation in any of my threads.

Thanks in advance,

Roger Bogh

BoghRD
11-16-2000, 05:54 PM
Found the solution. Someone mentioned the SQLDMO library in a solution to one of my questions on this topic. Here it is for anyone that cares:

<CODE><PRE>
'----------------------------------------------------
dim nYak as long
Dim OServerGroup As New SQLDMO.ServerGroup
Dim ORegisteredServer As New SQLDMO.RegisteredServer
Dim OSQLServer As New SQLDMO.SQLServer
Dim ODatabase As New SQLDMO.Database
Dim oServerApplications As New SQLDMO.Application

cMsg = "Available Servers:" & vbCrLf
nYak = oServerApplications.ListAvailableSQLServers.Count
For i = 1 To nYak
cMsg = cMsg & vbCrLf & oServerApplications.ListAvailableSQLServers.Item(i)
Next i
MsgBox cMsg

</CODE></PRE>
'------------------------------------------------------
Thanks,


Roger Bogh

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum