Re: Detecting SQL Server on a LAN

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Kevin Yu [MSFT] (v-kevy_at_online.microsoft.com)
Date: 03/18/04


Date: Thu, 18 Mar 2004 02:13:24 GMT

Thanks for Jack's quick response!

Hi Mike,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to find the instances of SQL
server on a LAN in your app. If there is any misunderstanding, please feel
free to let me know.

Just as Jack said, we can use SQLDMO Library. The ListAvailableSQLServers
method of the Application object will make it. Here I wrote a VB version as
an example.

    Dim a As New SQLDMO.Application
    Dim nl As SQLDMO.NameList
    
    Set nl = a.ListAvailableSQLServers()
    For i = 1 To nl.Count
        Me.Text1.Text = Me.Text1.Text & nl(i) & vbCrLf
    Next i

For more information, please check the following link.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqldmo/dmor
ef_m_l_9jfo.asp

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."



Relevant Pages