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



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++, 32-bit Editions 4.1
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 4.2

This article was previously published under Q249611

SYMPTOMS

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.

CAUSE

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

STATUS

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

Use the global MFC function AfxGetHENV to obtain the HENV.

REFERENCES

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

Modification Type:MajorLast Reviewed:12/8/2003
Keywords:kbbug kbfix kbVC600fix KB249611