Need help handling DataBase Access Exceptions
Sorry if my question is too simple to you. But I couldn't find the database access Exception names like NullConnectionException,SQLException kind of stuff in java. I want to catch the specific exceptions in my catch block, as follows:
try{
//database access
}catch(NullConnectionException ex)
{
throw new NullConnectionException ex(message);
}catch(SQLException sqlex)
{
throw new SQLException (message1);
}catch(Exception exp)
{
throw new Exception(message2);
}
Are there any Exceptions like NullConnectionException or SQLException that are specific for database access in C#? Or if not, how can I catch a specific exception when an exception occurs for database access? Thanks very much for your help.