FIX: Invalid Cursor State Using Visual FoxPro ODBC Driver

Last reviewed: September 19, 1997
Article ID: Q154683
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1

SYMPTOMS

Opening a CRecordset based on a data source that uses Visual FoxPro ODBC driver version 1.00.0083 may throw a CDBException with the following message (only with DB Tracing Enabled via "MFC Tracer" utility):

   "Invalid Cursor State"
   State 24000 native 0

The error occurs when SQLExtendedFetch is executed in CRecordset::InitRecord(). This code is at line 2597 in DBCORE.cpp.

CAUSE

"Background Fetching" is enabled in the Data Source Setup dialog box for the data source. Background fetching determines whether records are fetched in the background (progressive fetching) or whether your application will wait until all records in the result set are fetched. Having "Background Fetching" enabled triggers a bug within the FoxPro driver when used with the Cursor Library. This bug is intermittent but frequent with larger recordsets.

NOTE: The use of threads by an ODBC driver does not inherently imply that the driver is thread-safe. See the release notes of the driver for more information. Dynasets are also not supported with this version of the FoxPro ODBC Driver.

RESOLUTION

Turn off "Background Fetching" in the Data Source Setup dialog box for the data source.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. The bug has been fixed in the latest version of the Visual FoxPro driver. For additional information about how to obtain the latest driver, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q157767
   TITLE     : FILE: Updated Visual FoxPro ODBC Driver 5.0 Now Available

MORE INFORMATION

The error occurs randomly when using snapshot and cursor library and opening a recordset that results in a fairly large result set.

The error DOES NOT occur if you:

  1. Use readOnly, forwardOnly type recordset.
2. Turn off cursor library. 3. Set up a filter to retrieve a small result-set.

REFERENCES

See the Visual FoxPro ODBC Driver help file (DRVVFP.HLP).

The following FoxPro article discusses how to receive the latest FoxPro ODBC Driver:

   ARTICLE-ID:  Q149840
   TITLE:       Visual FoxPro ODBC Driver 1.0 Available in MS Software
                Library

Keywords          : MfcDatabase kbprg kbprg
Technology        : kbMfc
Version           : 4.0 4.1
Platform          : NT WINDOWS
Issue type        : kbprb
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 19, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.