SqlDataSourceEnumerator.GetDataSources can't return the Instance name and Version information on firewalled computers


  • Using SqlDataSourceEnumerator.GetDataSources Method, I can search the available SQL Server instances on my intranet. On the MSDN help, it says that this method will return a DataTable object that has information about visible/available SQL Server instances, and this includes the SQL Server's Version information.

    If the instances of SQL Server is on a firewalled computers that have Windows XP SP2 firewall or Windows Server 2003 SP1 firewall, the Datatable could not return the InstanceName and Version information. I've tried to make exceptions to the Windows Firewall by opening TCP port for SQL Server, port #1046 and #1433. I've searched MS KB and still can't fix it. If I turn off the firewall, I can retrieve full Instance name and Version information.

    Here's my code: (I dump the display to a ComboBox)

            private void btnQuerySQLDB_Click(object sender, EventArgs e)
                SqlDataSourceEnumerator sqlenum = SqlDataSourceEnumerator.Instance;
                dtsql = sqlenum.GetDataSources();
                foreach (DataRow row in dtsql.Rows)
                    comboBox1.Items.Add(row["ServerName"] + "\\ " + row["InstanceName"] + " (" + row["Version"] + ")");                


    Is this a bug or are there any workarounds? Please help.


    Friday, April 21, 2006 11:55 AM


All replies

  • With dynamic IP assignments the port numbers you want to expose/see can (and do) change. I would use the SQL Server Configuration Manager to drill into the TCP/IP ports and verify that you're exposing these ports. WARNING: exposing these ports to the web (by disabling the firewall) is tantamout to posting your home phone number on the wall in a bus station--you'll get a lot of unwanted activity on that port.
    Friday, April 21, 2006 6:07 PM
  • I've done checking the SQL Server Configuration Manager and check the TCP/IP configuration. It still has the ports of #1433 and the dynamic port #1046. I have opened bith ports, but I still can't get the version number.
    Is there anything more to do?

    Please help.
    Tuesday, April 25, 2006 12:25 PM
  • Do you have the SqlBrowser port (1434) open on the firewall?
    Tuesday, April 25, 2006 2:51 PM
  • I have tried that and it WORKS! Many thanks! I'm very sorry for my late resplies.

    Azalela, is this port number is documented?
    Wednesday, May 24, 2006 8:47 AM
  • Yes, thanks again! I'm sorry to pronounce your name incorrectly.
    Friday, June 16, 2006 2:53 PM
  • S'ok. I can't guarantee that I'm pronouncing it correctly, myself (parents got it out of a book with no associated phonetics). :-)
    Friday, June 16, 2006 7:17 PM

    My SQLBrower port is open (  TCP Still no InstanceName, no IsClustered, no Version info. Any ideal why?
    Thursday, May 01, 2008 8:14 PM