PRB: Visual C++ 1.5 ODBC Drivers Don't Support Dynasets

Last reviewed: July 18, 1997
Article ID: Q111815
1.50 WINDOWS kbprg kbprb

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), included with:

        - Microsoft Visual C++ for Windows, version 1.5
    

SYMPTOMS

An 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)

CAUSE

The 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.

RESOLUTION

To 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 INFORMATION

The 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
KBCategory: kbprg kbprb
KBSubcategory: MfcDatabase
Keywords : kb16bitonly MfcDatabase kbprb kbprg
Technology : kbMfc
Version : 1.50
Platform : WINDOWS


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: July 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.