Microsoft KB Archive/249611

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:14, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base

FIX: The Environment Handle Is Not Accessible When You Use Microsoft Foundation Classes Open Database Connectivity Classes

Article ID: 249611

Article Last Modified on 11/21/2006


  • Microsoft Foundation Class Library 4.2, when used with:
    • Microsoft Visual C++ 4.1 Subscription
    • Microsoft Visual C++ 5.0 Enterprise Edition
    • Microsoft Visual C++ 5.0 Professional Edition
    • Microsoft Visual C++ 4.2 Enterprise Edition
    • Microsoft Visual C++ 4.2 Professional Edition

This article was previously published under Q249611


When a program dynamically links to Microsoft Foundation Classes (MFC), the MFC Open Database Connectivity (ODBC) classes use an ODBC environment handle (HENV) that is declared local to the MFC DLL. Therefore, these programs do not have access to the MFC HENV.


This behavior occurs because the MFC ODBC classes are not designed to make the HENV available to the programmer.


This problem has been fixed with Microsoft Visual C++ 6.0.

Use the global MFC function AfxGetHENV to obtain the HENV.


For more information about the full syntax of the AfxGetHENV function, please refer to the following Microsoft Web site:

Additional query words: Q167910 henv 167910 CRecordset CDatabase couldn't cannot can't get

Keywords: kbbug kbfix kbvc600fix KB249611