ArithAbort in ADO.NET

Don’t ask me to explain it, but setting ARITHABORT in SQL Server is sometimes necessary for performance reasons.

In simple ADO.NET, you can use this pattern:

private static SqlConnection GetOpenConnection(string connectionString)
{
    SqlConnection conn = new(connectionString);
    conn.Open();
    conn.Execute("SET ARITHABORT ON;");
    return conn;
}

Leave a Reply

Your email address will not be published.