Bewerken

Share via


SqlConnection.ClientConnectionId Property

Definition

The connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or failed.

public:
 property Guid ClientConnectionId { Guid get(); };
public Guid ClientConnectionId { get; }
member this.ClientConnectionId : Guid
Public ReadOnly Property ClientConnectionId As Guid

Property Value

The connection ID of the most recent connection attempt.

Remarks

ClientConnectionId works regardless of which version of the server you connect to, but extended events logs and entry on connectivity ring buffer errors will not be present in SQL Server 2008 R2 and earlier.

You can locate the connection ID in the extended events log to see if the failure was on the server if the extended event for logging connection ID is enabled. You can also locate the connection ID in the connection ring buffer for certain connection errors. If the connection ID is not in the connection ring buffer, you can assume a network error.

Applies to

See also