Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

id dublication exception c# .net core

// 2627 is unique constraint (includes primary key), 2601 is unique index
catch (UpdateException ex) when (ex.InnerException is SqlException sqlException && (sqlException.Number == 2627 || sqlException.Number == 2601))
{

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #id #dublication #exception #core
ADD COMMENT
Topic
Name
7+2 =