獲取本機SqlServer名稱

2022-08-09 19:27:20 字數 732 閱讀 9779

using system.data.sql; 

//檢索包含有關可用sql server例項的資訊的表,必須先使用共享/靜態instance屬性來檢索列舉器

sqldatasourceenumerator instance = sqldatasourceenumerator.instance;

//呼叫 getdatasources 方法,返回包含可用伺服器的相關資訊的datatable

system.data.datatable table = instance.getdatasources();

//取出伺服器名稱

string servername=table.rows[0]["servername"].tostring();

返回的table資訊:

column

description

servername

name of the server.

instancename

name of the server instance. blank if the server is running as the default instance.

isclustered

indicates whether the server is part of a cluster.

version

version of the server. for example:

獲取本機所有的ADSL連線名稱

真鬱悶呀,就這點 費半天勁,dotras怎麼會沒有這個功能呢?dotras的就只有乙個獲取dotras.rasconnection.getactiveconnections這應該是活動連線 呼叫方法 dim stradsl as string ras.listadsl if stradsl then...

sql server 獲取本機的ip位址

sql server 獲取本機的ip位址 其實就是使用xp cmdshell 來獲取資訊,然後對資訊進行篩選。開啟xp cmdshell exec sp configure show advanced options 1 reconfigure with override exec sp confi...

如何獲取本機電腦的AD網域名稱稱

如何獲取本機電腦的ad網域名稱稱,該 參考了msdn幫助文件裡面所寫的內容 define win32 winnt 0x0500 include include include void tmain void int cnf 0 dword dwsize sizeof buffer for cnf 0...