ServerConnection.TrueName 屬性
取得伺服器的名稱。
命名空間: Microsoft.SqlServer.Management.Common
組件: Microsoft.SqlServer.ConnectionInfo (在 Microsoft.SqlServer.ConnectionInfo.dll 中)
語法
'宣告
Public Property TrueName As String
Get
Set
'用途
Dim instance As ServerConnection
Dim value As String
value = instance.TrueName
instance.TrueName = value
public string TrueName { get; set; }
public:
property String^ TrueName {
String^ get ();
void set (String^ value);
}
member TrueName : string with get, set
function get TrueName () : String
function set TrueName (value : String)
屬性值
型別:String
指定伺服器名稱的 String 值。
備註
伺服器名稱相當於 Transact-SQL @@SERVERNAME 函數傳回的值。
範例
C#
ServerConnection conn = new ServerConnection();
Console.WriteLine(conn.TrueName);
PowerShell
$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
Write-Host $conn.TrueName