在C#中获取网络上所有sql server实例的列表
亲爱的专家,
为了获取我使用以下代码的sql server实例列表。
Dear Experts,
For getting the list of sql servers instances on the i am using the below code.
SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
public DataTable GetInstances()
{
DataTable dtInstancesList = new DataTable();
dtInstancesList = instance.GetDataSources().Select("", "ServerName ASC").CopyToDataTable();
return dtInstancesList;
}
我收到服务器列表,工作正常。
但这里的问题是,
在我的网络中,我们有两个域名,如A和B.
1.如果我在域A中运行此代码:
我正在获取SQL服务器实例的完整列表。
例如这里我得到的数量是100
2.如果我运行域B中的相同代码:
我没有获得SQl服务器实例的完整列表。
例如这里我的数量是10
为什么会这样,请告诉我解决方案。
I am getting the server list, its working fine.
But the problem here is,
In my network we are having two domains like A and B.
1. If i run this code in Domain A:
I am getting full list of SQL server instances.
for example here i am getting count is 100
2. If i run the same code in Domain B:
I am not getting the full list of SQl server instances.
for example here i am getting count is 10
Why this is happening, please let me know the solution.