I am trying to enlist all the SQL Server instances (Local and Network) in a ComboBox by using the following code:
DataTable dt = null;
dt = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();
foreach (DataRow dr in dt.Rows)
{
ComboBox1.Items.Add(dr[0].ToString() + "\\" + dr[1].ToString());
}
It works fine on Windows XP 32 Bit, Windows 7 64 Bit by enlisting all of my local and network sql server instances in the combo, but when this piece of code runs on Windows 7 32bit (All Professional version) it takes long time to fetch the instance details and ultimately fails to enlist even a single instance (which i believe due to some sort of TimeOut). The data table does not have even a single row in this case. Thus I want to ask following questions:
Does this problem is platform specific or OS specific?
Is it really due to slow network speed/ large no. of server instances on the network?
Is there any alternate to this requirement which is not platform or framework dependent as
SmoApplication.EnumAvailableSqlServers(false); // local and Network SQL instances
is framewrok dependent.
I have got at least 17-20 Network Server of SQL Server which I expect this function to return. Hence I can not understand how this could happen? I am encountering this problem precisely on Windows 7 32bit (Professional version).
Thank you
Hemant Jaiswal