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();
      comboBox1.Items.Clear();
      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.

 



Answer this question

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

  • MikeBarta411

    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.

  • Bob Briggs

  • WS_progger_starter

    Yes, thanks again! I'm sorry to pronounce your name incorrectly.

  • macv3x

    I have tried that and it WORKS! Many thanks! I'm very sorry for my late resplies.

    Azalela, is this port number is documented

  • CsharpDotnetDeveloper

    S'ok. I can't guarantee that I'm pronouncing it correctly, myself (parents got it out of a book with no associated phonetics). :-)


  • Kay2live

    Do you have the SqlBrowser port (1434) open on the firewall


  • Sukh

    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.

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