Breyta

Deila með


SqlConnection.WorkstationId Property

Definition

Gets a string that identifies the database client.

public:
 property System::String ^ WorkstationId { System::String ^ get(); };
public string WorkstationId { get; }
[System.Data.DataSysDescription("SqlConnection_WorkstationId")]
public string WorkstationId { get; }
member this.WorkstationId : string
[<System.Data.DataSysDescription("SqlConnection_WorkstationId")>]
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.

Attributes

Examples

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

private static void OpenSqlConnection(string connectionString)
{
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
        connection.Open();
        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)
        connection.Open()
        Console.WriteLine("ServerVersion: {0}", connection.ServerVersion)
        Console.WriteLine("WorkstationId: {0}", connection.WorkstationId)
    End Using
End Sub

Remarks

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