Error Handling

The Desktop Database Drivers can return both ODBC and Microsoft Jet errors. A call to SQLError returns an ODBC SQLSTATE value, a Microsoft Jet error code (if applicable), and an error message. The error message can include an ODBC component identifier, a data-source identifier from Microsoft Jet, a text message from ODBC, and data-source-supplied text from Microsoft Jet.

The native Microsoft Jet error codes can be an important indicator of the nature of a problem. This is especially true when SQLSTATE S1000 (General error) is returned, because the ODBC error text for this SQLSTATE value does not convey any information about the problem. An application must rely on the Microsoft Jet error code in this case, and possibly the error message. Some Microsoft Jet error codes are returned for more than one type of error, in which case the error message must be used to determine the error that occurred.

The Desktop Database Drivers handle most ODBC errors, but the Driver Manager handles state transition errors, invalid arguments, connection option errors, and errors in calls to the driver. The ODBC component identifier in the error message text indicates the component that returns an error.

See Also For a list of Microsoft Jet error codes, see Appendix D, “Error Reference.”