Using Formal Error Handling (Ready, “Catch”!)

An exception occurs when an error condition is encountered. Whether you want to handle it depends on the requirements that you are trying to meet. Certain error conditions might be tolerable but others are not. Typical error conditions would be things like database connection denied or lost, unsuccessful update operations, or even divide-by-zero errors. .NET refers to these conditions as “exceptions” and provides several features to the developer to devise the appropriate response (or lack of response). The primary error-handling constructs we will be using are either the Try/Catch/Finally structure or the On Error construct. But, before discussing these constructs, let's look at an overall error-handling ...

Get Sams Teach Yourself ADO.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.