framework is endowed with provider specific exception class that u can use to handle exception from database. for instance to handle exceptions from SQL Server u can use System.Data.SqlClient.SqlException class. Similarly for OLE DB data source use System.Data.OleDb.OleDbException class.