简体   繁体   English

EnumAvailableSqlServers返回空列表

[英]EnumAvailableSqlServers returns empty list

I have a strange situation where i have added a reference to 我有一个奇怪的情况,我添加了对

Microsoft.SqlServer.Smo Microsoft.SqlServer.ConnectionInfo Microsoft.SqlServer.Management.Sdk.Sfc Microsoft.SqlServer.Smo Microsoft.SqlServer.ConnectionInfo Microsoft.SqlServer.Management.Sdk.Sfc

and a call to SmoApplication.EnumAvailableSqlServers returns a DataTable of available servers, when it is run on my development machine. 当在我的开发计算机上运行SmoApplication.EnumAvailableSqlServers时,将返回可用服务器的数据表。

When I deploy to my colleague's machine, the DataTable is returned empty. 当我部署到同事的机器上时,DataTable返回为空。

Strangely, the following 奇怪的是,以下

        Dim server As New Microsoft.SqlServer.Management.Smo.Server("localhost\sqlexpress")
        For Each db In server.Databases
            DoSomething(db.name)
        Next

Does return the installed databases on both machines. 不会在两台计算机上返回已安装的数据库。

I have been using the simplest deployment, ie copying the \\bin\\Release directory. 我一直在使用最简单的部署,即复制\\ bin \\ Release目录。 I suspected there is a missing assembly on the other machine, but the fact that the databases are returned on both machines contradicts that, maybe. 我怀疑另一台机器上缺少程序集,但是两台机器上都返回了数据库这一事实可能与此矛盾。

Ideas? 想法?

I also had the same issue. 我也有同样的问题。 I resolved it by starting the SQL Server Browser service. 我通过启动SQL Server Browser服务来解决它。 http://msdn.microsoft.com/en-us/library/ms165734(v=sql.90).aspx http://msdn.microsoft.com/en-us/library/ms165734(v=sql.90).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM