FIX: Invalid Cursor State Using Visual FoxPro ODBC Driver

ID: Q154683


The information in this article applies to:


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:

Q157767 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:

Q149840 Visual FoxPro ODBC Driver 1.0 Available in MS Software Library

Additional query words:


Keywords          : kbprg kbDatabase kbMFC kbODBC kbVC 
Version           : 4.0 4.1
Platform          : NT WINDOWS 
Issue type        : kbprb 

Last Reviewed: July 26, 1999