Handling Database Errors

The .NET Framework includes two classes within the System.Data.SqlClient namespace that are useful in handling SQL Server errors. The SqlException class can be used to catch SQL Server–related errors and warnings. The SqlException object exposes an Errors property, which is a collection of SqlError objects. The SqlError object contains information related to errors and warnings generated by the SQL server. In addition to encountering operational errors, when multiple users make changes to data within separate DataSets and then attempt to update the values in the data source, the question arises over which one of the conflicting changes will “win.” You can control the resolution of this situation through the UpdateCommand ...

Get Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) 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.