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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.