<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />

SqlConnection

public sealed class SqlConnection : DbConnection
Represents a connection to a SQL Server database. This class cannot be inherited.
public Guid ClientConnectionId { get; }

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

public bool FireInfoMessageEventOnUserErrors { get; set; }

Gets or sets the FireInfoMessageEventOnUserErrors property.

public int PacketSize { get; }

Gets the size (in bytes) of network packets used to communicate with an instance of SQL Server.

public bool StatisticsEnabled { get; set; }

When set to true, enables statistics gathering for the current connection.

public string WorkstationId { get; }

Gets a string that identifies the database client.

Occurs when SQL Server returns a warning or informational message.

public SqlConnection()

Initializes a new instance of the SqlConnection class.

public SqlConnection(string connectionString)

Initializes a new instance of the SqlConnection class when given a string that contains the connection string.

public static void ClearAllPools()

Empties the connection pool.

public static void ClearPool(SqlConnection connection)

Empties the connection pool associated with the specified connection.

Starts a database transaction.

Starts a database transaction with the specified isolation level.

public SqlTransaction BeginTransaction(IsolationLevel iso, string transactionName)

Starts a database transaction with the specified isolation level and transaction name.

public SqlTransaction BeginTransaction(string transactionName)

Starts a database transaction with the specified transaction name.

Creates and returns a SqlCommand object associated with the SqlConnection.

public void ResetStatistics()

If statistics gathering is enabled, all values are reset to zero.

Returns a name value pair collection of statistics at the point in time the method is called.