[英]How to list SQL 2005 Express instances
I would like to list what instances of SQL 2005 Server (Express Editon) are installed on local or remote machine (my app is in Native C++). 我想列出在本地或远程计算机上安装了哪些SQL 2005 Server(Express Editon)实例(我的应用程序在Native C ++中)。 I found that i can make it by SQLDMO, however it seems that SQLDMO does not see SQL 2005 Express Edition and call to ListAvailableSqlServers returns empty list.
我发现我可以通过SQLDMO做到这一点,但是SQLDMO似乎看不到SQL 2005 Express Edition,并且对ListAvailableSqlServers的调用返回空列表。
How can i make it? 我该怎么做? Playing with system registry is an extreme solution and applies only for local machines.
使用系统注册表是一种极端的解决方案,并且仅适用于本地计算机。
Got it... Found SQLBrowseConnect. 知道了...找到了SQLBrowseConnect。 Answer is as usual in MSDN :-)
答案与MSDN一样:-)
You can try SqlDataSourceEnumerator.GetDataSources() . 您可以尝试SqlDataSourceEnumerator.GetDataSources() 。 Works well in C# and VB.Net though I haven't tried it from C++.
尽管我还没有从C ++尝试过,但是在C#和VB.Net中效果很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.