0
 DataTable dataTable = SmoApplication.EnumAvailableSqlServers(false);
 comboBox1.ValueMember = "Name";
 comboBox1.DataSource = dataTable;

i am trying to populate a combobox control with a list of SQL Servers available on the company network with the above code but am getting the error below.

failed to retrieve data for this request

the code works on the development machine but fails on a client PC that has even has SQL Server 2012 Shared Management Objects installed.

4

1 回答 1

0

枚举受制于目标上启用的SQL Server Browser 服务(默认情况下禁用),并受制于现场特定子网 UDP 广播限制。换句话说,是不可靠的。如果您想发现 SQL Server 安装,您应该让管理员提供服务器列表或使用WMI和 AD 数据库。

于 2013-05-16T14:49:04.283 回答