Wednesday, March 7, 2012

Retrieve SQL servers in the network

Hi all
Is there any way to retrive all available SQL servers on the network without using the SQL DMO objects?

Thanks in advance.hello...

from SMO sample:
============================
Dim dt As DataTable
dt = Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers(False)
For Each dr As DataRow In dt.Rows
serverListBox1.Items.Add(dr(0).ToString())
Next
============================|||

Thanks a lot Jung but I'm looking for a solution outside the components. i.e. an API function or something because I don’t want to deploy neither the DMO nor the SMO to my clients.
I wonder how the property pages of a UDL file can retrieve the servers without installing neither of the components

|||I don't know for sure but I am guessing that the UDL dialog uses the ODBC Function BrowseConnect or NetServerEnum. You need to call these functions via PInvoke from managed code with Fx 1.1 with Fx 2.0 there is a managed API.

Http://www.sqldev.net has further explanations.

-Euan|||Make sure your SQL Browser service is up and running.

No comments:

Post a Comment