如何获取SQL Server的实例名称 [英] How To get Instance Name Of SQL Server

查看:121
本文介绍了如何获取SQL Server的实例名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作报表设计器,它生成所有类型的报表,不同类型的数据库,例如excel,access,sqlserver,oracle

但是问题是我无法获取所有Sql Server实例名称
我的代码仅提供服务器名称(例如PC名称),而不提供实例名称(例如SQL Express)

这是我的代码

I''m Making Report Designer Its generate Report Of all type Of different database Like excel,access,sqlserver, oracle

But Problem Is that I''m Fail Getting All Sql Server Instance Name
My code giving only server name like PC name not Instance name like SQL Express

here My code

public static SqlDataSourceEnumerator Instance = SqlDataSourceEnumerator.Instance; //Get server Names
public static DataTable Table = new DataTable();
Table = Instance.GetDataSources();


但是它没有给出实例名称
我的代码有什么问题
获取SQL Server实例名称的任何其他方法
请............快帮我


在前进


But Its Not Giving Instance Name
what wrong With My Code
Any Another Way To Get SQL Server Instance Name
Please............ Help Me Fast


thanks In Advance

推荐答案

您的代码与
Your code looks very similar to the example in MSDN[^].
Have you tried the second part (DisplayData()) as well?
Maybe the instance name is delivered in another column than the one you looked in.


这篇关于如何获取SQL Server的实例名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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