Bagikan melalui


SqlConnection.WorkstationId Properti

Definisi

Mendapatkan string yang mengidentifikasi klien database.

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

Nilai Properti

String yang mengidentifikasi klien database. Jika tidak ditentukan, nama komputer klien. Jika tidak ditentukan, nilainya adalah string kosong.

Atribut

Contoh

Contoh berikut membuat SqlConnection dan menampilkan WorkstationId properti .

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

Keterangan

String biasanya berisi nama jaringan klien. Properti WorkstationId sesuai dengan Workstation ID properti string koneksi.

Berlaku untuk

Lihat juga