Microsoft KB Archive/321743

From BetaArchive Wiki
Knowledge Base


Porting issues with Visual Studio .NET OLE DB Provider Template classes

Article ID: 321743

Article Last Modified on 3/21/2005



APPLIES TO

  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition



This article was previously published under Q321743

SUMMARY

This article summarizes the issues that developers have experienced when they port code from the Microsoft Visual C++ 6.0 OLE DB Provider Template classes to the Visual Studio .NET OLE DB Template classes.

MORE INFORMATION

The following list describes changes that may affect your code:

  • The Active Template Library (ATL) OLE DB Provider Templates that are included with Visual Studio .NET change the internal members, m_rgRowHandles and m_rgBindings, to CAtlMap objects. This new map object returns a CPair object for the Lookup method. You must reference the m_value member to get the object that you are looking up. For example:

    m_rgRowHandles.Lookup(hRow)->m_value
                            

    Visual C++ 6.0 code uses the CAutoMemRelease class, which is replaced with the CComHeapPtr class in Visual Studio .NET.

  • If you implemented any of your own IRowsetNotify connection points, you may now have a conflict when you build. For example, if you implemented a method named Fire_OnRowChange, ATL includes additional code in the Atldb.h file that appears as follows:

    __if_exists(T::Fire_OnRowChange)
                            

    This causes a conflict because the ATL code thinks that you are using its new IRowsetNotify implementation and adds code when it should not. You receive the following compiler error message:

    error C2039: 'IncrementMutex' : is not a member of 'CMSOmniProvRowset'

    The ATL code should appear as follows:

    __if_exists(ATL::T::Fire_OnRowChange)
                            

    This is a bug.

  • If you use the CSimpleArray class in your code, note that this class is replaced with CAtlArray.


REFERENCES

For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

254633 OmniProv.exe - A sample ATL OLE DB provider for custom databases


321909 BUG: ATL OLE DB provider returns incorrect length for variable-length string field



Additional query words: C++ OLE DB Template classes

Keywords: kbinfo kbprovider kbmdacnosweep KB321743