Вопрос

 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.

Это было полезно?

Решение

Enumeration is subject to SQL Server Browser Service being enabled on the target(s) (by default is disabled) and is subject to on-site specific subnet UDP broadcast restrictions. In other words is extremely unreliable. If you want to discover SQL Server installations you should either have an administrator provide a list of servers or use WMI and the AD database.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top