When either DB-Library for Visual Basic or SQL Server encounter an error condition, the error is reported to your application. To respond to error conditions, DB-Library for Visual Basic applications must implement an error handler and a message handler.
Errors detected by DB-Library for Visual Basic (such as a failure to connect to SQL Server) invoke the error handler, and provide information such as a description of the error and a severity rating. Errors detected by SQL Server (for example, invalid SQL syntax) are sent back to the client as messages and invoke both the error handler and the message handler. Based on the error information, the code that you supply for each handler can take whatever actions you define, such as informing the user of a problem.
The sections that follow tell how to implement each type of handler, and provide examples. The sample applications include examples of error and message handlers.