try catch deadlock sql server
The Microsft SQL Server-specific error code for a deadlock is 1205 so you'd need to handle the SqlException and check for that. So, e.g. if for all other types of SqlException you want the bubble the exception up:
catch (SqlException ex)
{
if (ex.Number == 1205)
{
// Deadlock
}
…
Top comments (0)