EnumAvailableSqlServers返回空列表 [英] EnumAvailableSqlServers returns empty list

查看:258
本文介绍了EnumAvailableSqlServers返回空列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种奇怪的情况,我已经添加了一个参考

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

和调用SmoApplication.EnumAvailableSqlServers返回可用服务器的数据表,当它运行在自己的计算机。

and a call to SmoApplication.EnumAvailableSqlServers returns a DataTable of available servers, when it is run on my development machine.

当我部署到我同事的机器,DataTable中返回空的。

奇怪的是,以下

        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.

我一直在用最简单的部署,即复制\斌\ Release目录。我怀疑是有缺失的组件,在另一台机器上,但该数据库在两台机器上返回的事实相矛盾的是,也许吧。

I have been using the simplest deployment, i.e. copying the \bin\Release directory. 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.

想法?

推荐答案

我也有同样的问题。我通过启动SQL Server Browser服务解决它。 HTTP ://msdn.microsoft.com/en-us/library/ms165734(V = SQL.90)的.aspx

I also had the same issue. I resolved it by starting the SQL Server Browser service. http://msdn.microsoft.com/en-us/library/ms165734(v=sql.90).aspx

这篇关于EnumAvailableSqlServers返回空列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆