Export (0) Print
Expand All

SqlConnection.ClientConnectionId Property

.NET Framework 4.5

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

Namespace:  System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public Guid ClientConnectionId { get; }

Property Value

Type: System.Guid
The connection ID of the most recent connection attempt.

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 (Connectivity troubleshooting in SQL Server 2008 with the Connectivity Ring Buffer) for certain connection errors. If the connection ID is not in the connection ring buffer, you can assume a network error.

.NET Framework

Supported in: 4.6, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft