SqlConnection.WorkstationId SqlConnection.WorkstationId SqlConnection.WorkstationId SqlConnection.WorkstationId Property


Gets a string that identifies the database client.

 property System::String ^ WorkstationId { System::String ^ get(); };
public string WorkstationId { get; }
member this.WorkstationId : string
Public ReadOnly Property WorkstationId As String

Property Value

A string that identifies the database client. If not specified, the name of the client computer. If neither is specified, the value is an empty string.


The following example creates a SqlConnection and displays the WorkstationId property.

private static void OpenSqlConnection(string connectionString)
    using (SqlConnection connection = new SqlConnection(connectionString))
        Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
        Console.WriteLine("WorkstationId: {0}", connection.WorkstationId);
Private Sub OpenSqlConnection(ByVal connectionString As String)
    Using connection As New SqlConnection(connectionString)
        Console.WriteLine("ServerVersion: {0}", connection.ServerVersion)
        Console.WriteLine("WorkstationId: {0}", connection.WorkstationId)
    End Using
End Sub


The string typically contains the network name of the client. The WorkstationId property corresponds to the Workstation ID connection string property.

Applies to

See also