EnumAvailableSqlServers returns empty list

吃可爱长大的小学妹 提交于 2019-12-02 05:34:34

问题


I have a strange situation where i have added a reference to

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.

When I deploy to my colleague's machine, the DataTable is returned empty.

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, 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.

Ideas?


回答1:


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



来源:https://stackoverflow.com/questions/7460567/enumavailablesqlservers-returns-empty-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!