views:

70

answers:

1

I'm trying to list all the SLQ Servers that are available on our Network in a gridview on a form. I have this code in a button click event.

SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
System.Data.DataTable myDataTable = instance.GetDataSources();

gvSqlServers.DataSource = myDataTable;
gvSqlServers.DataBind();

It runs but nothing shows up in the gridview and I don't get any errors.

+1  A: 

As a start, I believe the SQL Servers must have SQL Browsing turned on, which is off many times. Otherwise I'm guessing that your application wouldn't find it anyways.

When I run your code on my local box from a Windows Form app, it works fine

I also ran the same code in ASP.NET and it works as well.

My guess is that it is an issue with SQL Browsing or possibly something else preventing the SQL servers from broadcasting

Cody C
When i use the wizard in VS it finds the servers. Can vs still find them if Browsing is turned off?
FashionHouseJewelry.com
no. with browsing turned off, it does NOT worked.
Cody C