3 ms·
I do not know of a good Cross DB solution. It may be more elegant to check specific exception types for the DBMSs that you do use. For example, MySQL would be:
by caleblloyd 9y ago
I do not know of a good Cross DB solution. It may be more elegant to check specific exception types for the DBMSs that you do use. For example, MySQL would be:
https://github.com/mysql-net/MySqlConnector/blob/master/src/MySqlConnector/MySql.Data.MySqlClient/MySqlException.cs https://github.com/mysql-net/MySqlConnector/blob/master/src/...
Check that MySqlException.Number == 1062 for Duplicate entry.
Add one check per DBMS that you use.