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

SqlException

public sealed class SqlException : DbException
The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.
public byte Class { get; }

Gets the severity level of the error returned from the .NET Framework Data Provider for SQL Server.

public Guid ClientConnectionId { get; }

Represents the client connection ID. For more information, see Data Tracing in ADO.NET.

public SqlErrorCollection Errors { get; }

Gets a collection of one or more SqlError objects that give detailed information about exceptions generated by the .NET Framework Data Provider for SQL Server.

public int LineNumber { get; }

Gets the line number within the Transact-SQL command batch or stored procedure that generated the error.

public int Number { get; }

Gets a number that identifies the type of error.

public string Procedure { get; }

Gets the name of the stored procedure or remote procedure call (RPC) that generated the error.

public string Server { get; }

Gets the name of the computer that is running an instance of SQL Server that generated the error.

public byte State { get; }

Gets a numeric error code from SQL Server that represents an error, warning or "no data found" message. For more information about how to decode these values, see Database Engine Events and Errors.