Handling Data Errors
Consuming and manipulating data.
Handle data errors.
Although error trapping has been left out of the code so far in this chapter for the sake of simplicity, in real life you can't afford to do that. You should always check for errors in any production code, so that you can take corrective action if something goes wrong. The following sections show you how to deal with two groups of data errors. First, you might attempt an operation that causes an error from the underlying database. Second, in a multiuser situation errors can be caused by two or more users editing the same row of data.
Handling Database Errors
Many things can go wrong when you're working with a database. You might try to add a duplicate value to a column that ...
Get MCAD/MCSD.NET Training Guide (Exam 70-316): Developing and Implementing Windows®-Based Applications with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET 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.