HOWTO: Get More Information on the ODBC Call Failed ErrorLast reviewed: July 14, 1997Article ID: Q161288 |
The information in this article applies to:
SUMMARYThis article describes how to get more information on the ODBC Call Failed error. When errors occur using ODBC databases, Visual Basic will provide an "ODBC Call Failed" error message. This generic error message provides no specific detail so you must cycle through the Errors collection to get additional information. Below is a code sample that shows the difference in behavior.
MORE INFORMATIONThe DBEngine has an Errors collection that can be manipulated by the FOR- EACH construct. The JET Engine can store multiple errors in the DBEngine Errors collection. In Visual Basic 3.0, it was possible to parse the string using the routine shown on Page 175 of the Visual Basic 4.0 Professional Features Book under the "Guide to Data Access Objects" section. The # symbol was used to separate the "ODBC Call Failed" message from the detailed ODBC description in Visual Basic 3.0. However, this is not necessary under Visual Basic versions 4.0 and 5.0. For the example below, a two-field table called MyTable has been set up on an ODBC Source and a primary key set on the ID Field. Two records have been added as below:
Field ID Description =============================== Record 1 1 Hello Record 2 2 WorldThe code below will generate an error by trying to add a record with a duplicate primary key value to test the code:
REFERENCESVisual Basic 4.0 Professional Features, Chapter 9 of the "Guide to Data Access Object" Jet Database Engine Programmers Guide, pages 425-427 For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q120763 TITLE : How to Retrieve Info from RAISERROR Function in SQL Server DB |
Additional query words: errors Collection
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |