PRB: Visual C++ 1.5 ODBC Drivers Don't Support DynasetsLast reviewed: July 18, 1997Article ID: Q111815 |
1.50
WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSAn attempt to create a dynaset CRecordset object may cause a message box to appear with the following message:
Internal application error.If the debug version of the Microsoft Foundation Class (MFC) library is used and TRACE() diagnostics are enabled (see MFC Technical Note 7 "Debugging Trace Options" for more information), the following TRACE() messages may appear in the Output window of the debugger:
ODBC driver does not support dynasets. Warning: Throwing an Exception of type CDBException Warning: Throwing an Exception of type CDBException Warning: Uncaught exception in WindowProc (returning 0) CAUSEThe ODBC (Open Database Connectivity) driver being used doesn't support dynasets. The ODBC drivers provided with Visual C++ version 1.5 don't support dynasets.
RESOLUTIONTo use the dynaset attribute of a CRecordset object, you must acquire an ODBC driver that will support the features of a dynaset. MFC Technical Note 42 "ODBC Driver Developer Recommendations" lists the requirements for an ODBC driver if it is to be used for creating dynaset CRecordsets. They are:
SQLGetInfo, SQL_ODBC_VER must return > "01". SQLGetInfo, SQL_SCROLL_OPTIONS must support SQL_SO_KEYSET_DRIVEN. SQLGetInfo, SQL_ROW_UPDATES must return "Y". SQLGetInfo, SQL_POSITIONED_STATEMENTS must support SQL_PS_POSITIONED_DELETE and SQL_PS_POSITIONED_UPDATE.In addition, if pessimistic locking is requested, a call to SQLSetPos with irow 1, fRefresh FALSE, and fLock SQL_LCK_EXCLUSIVE will be made.
MORE INFORMATIONThe information below comes from the README.WRI file included with Visual C++ version 1.5, and discusses what needs to be done to enable dynaset support when using an ODBC driver that meets the requirements shown above.
CDatabase::Open forces loading of ODBC's cursor library with the ::SQLSetConnection SQL_ODBC_CURSORS call in dbcore.cpp, line 238. Forced loading of the cursor library ensures the SQL_SCROLL_STATIC scroll option is supported for snapshots, even if the underlying driver does not support scrolling. In order to open a recordset as a dynaset, the driver must support SQL_SCROLL_KEYSET, and the forced loading of the cursor library must be changed to optional loading. This can be done by changing the scroll option argument in the ::SQLSetConnection call mentioned above from SQL_CUR_USE_ODBC to SQL_CUR_USE_IF_NEEDED. This will cause the cursor library to NOT be loaded if the underlying driver supports SQLExtendedFetch. Note that snapshots require either the cursor library to be loaded, or for the underlying driver to support SQL_SCROLL_STATIC. |
Additional reference words: 1.50 2.50 technote tech note
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |