Group: Forum Members
Posts: 436,
Visits: 944
|
How would I catch a specific exception? For instance I have a table with a compound primary key... the primary key is not an auto increment but I dont want to allow duplicates to be inserted. When I try to insert a duplicate it throws an exception, naturally. I am able to trap the SQLException but I'm not sure how to catch that specific 'Violation of PRIMARY KEY constraint'...
Should I query the table before I attempt the insert instead of trying to catch the exception?
|