Catch REFERENCE constraint exception from SQL in C# -


What is the proper way to catch an exception that removes the SQL Server with a lack of reference from the C # code? I want to show my user message like this:
"I can not delete data because it's used instead of showing the message"
,:

  DELETE statement contradiction with context reference barrier ... conflict "rampa" ccurred in database, table "dbo.doc", column 'kartica_id'  

Comments