共用方式為


ServerConnection.TrueName 屬性

Gets the name of the server.

命名空間:  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)

屬性值

型別:System.String
A String value that specifies the name of the server.

備註

The name of the server is the equivalent to the value returned by the @@SERVERNAME Transact-SQL function.

範例

C#

ServerConnection conn = new ServerConnection();
Console.WriteLine(conn.TrueName);

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
Write-Host $conn.TrueName

請參閱

參考

ServerConnection 類別

Microsoft.SqlServer.Management.Common 命名空間