ServerConnection.TrueName Property

Gets the name of the server.

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

Syntax

'Declaration
Public Property TrueName As String 
    Get 
    Set
'Usage
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)

Property Value

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

Remarks

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

Examples

C#

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

PowerShell

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

See Also

Reference

ServerConnection Class

Microsoft.SqlServer.Management.Common Namespace