The information in this article applies to:
SYMPTOMS
There are two bugs in the MFC code that are exposed when using the MFC ODBC
classes with the Microsoft SQL Server ODBC driver version 2.65.0201 that
ships with Microsoft SQL Server 6.5. Setting synchronous mode works around
this problem.
The CDBException contains an m_nRetCode value of 2 (SQL_STILL_EXECUTING). CAUSEVersion 2.65.0201 of the Microsoft SQL Server ODBC driver can return SQL_STILL_EXECUTING from two ODBC API functions that previous versions of the driver implemented as synchronous. This change in the driver has led to the exposure of two bugs in the MFC ODBC classes. MFC wraps ODBC API function calls in one of two wrapper macros: AFX_SQL_SYNC for those calls that are expected to return only when completed; and AFX_SQL_ASYNC for those calls that can return SQL_STILL_EXECUTING. There are two places in the MFC ODBC classes where the wrong macro is used (Visual C++ 4.1 source code shown):
Both SQLNumResultCols() and SQLSetPos() can return SQL_STILL_EXECUTING.
While the bug in IsOpen() may appear to be more serious, since IsOpen() is
called frequently in the MFC code, it is less likely that the driver will
return SQL_STILL_EXECUTING for this API function than for SQLSetPos().
RESOLUTION
It is recommended that you set the synchronous mode to "on" for all
connections that use this version of the SQL Server ODBC driver. Since most
applications do not actually need to do asynchronous processing, this is
the most direct solution. By setting synchronous mode, you guarantee that
every ODBC API function will return only when completed.
-or- STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition version 4.2. MORE INFORMATIONNote that the responsibility for this problem does not lie with the SQL Server ODBC driver, but with the MFC ODBC classes. The ODBC 2.0 specification states that SQLSetPos and SQLNumResultCols can return SQL_STILL_EXECUTING. REFERENCESFor more information, please see: ODBC 2.0 Programmer's Reference and SDK Guide (available Online). Additional query words: kbVC400bug 2.00 2.10 2.20 4.00 4.10 4.20 vcfixlist420 MfcDatabase
Keywords : kbDatabase kbMFC kbODBC kbVC |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |