FIX: CTABLESRow Missing TABLE_PROPID Column (201387)



The information in this article applies to:

  • Microsoft OLE DB, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q201387

SYMPTOMS

The OLE DB Provider Templates define the following class to implement the OLE DB's TABLES rowset (please note that this definition of this class is incomplete):
class CTABLESRow
{
public:

   WCHAR m_szCatalog[129];
   WCHAR m_szSchema[129];
   WCHAR m_szTable[129];
   WCHAR m_szType[129];
   WCHAR m_szDesc[129];
   GUID  m_guid;

   CTABLESRow()
   {

      m_szCatalog[0] = NULL;
      m_szSchema[0] = NULL;
      m_szTable[0] = NULL;
      m_szType[0] = NULL;
      m_szDesc[0] = NULL;
      m_guid = GUID_NULL;

   }

BEGIN_PROVIDER_COLUMN_MAP(CTABLESRow)

   PROVIDER_COLUMN_ENTRY("TABLE_CATALOG", 1, m_szCatalog)
   PROVIDER_COLUMN_ENTRY("TABLE_SCHEMA", 2, m_szSchema)
   PROVIDER_COLUMN_ENTRY("TABLE_NAME", 3, m_szTable)
   PROVIDER_COLUMN_ENTRY("TABLE_TYPE", 4, m_szType)
   PROVIDER_COLUMN_ENTRY("TABLE_GUID", 5, m_guid)
   PROVIDER_COLUMN_ENTRY("DESCRIPTION", 6, m_szDesc)

END_PROVIDER_COLUMN_MAP()

};
				

CAUSE

A required column, TABLE_PROPID, is missing.

RESOLUTION

To fix the problem, you can modify the CTABLESRow class definition to include TABLE_PROPID. The CTABLESRow class is defined in the Atldb.h file located in the C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include directory.

The following code shows the changes that need to be made:
class CTABLESRow
{
public:

   WCHAR m_szCatalog[129];
   WCHAR m_szSchema[129];
   WCHAR m_szTable[129];
   WCHAR m_szType[129];
   WCHAR m_szDesc[129];
   GUID  m_guid;
   ULONG m_ulPropID;  // Add this line.
   // NOTE:  We don't bind DateCreated and DateModified because 1.x
   // providers do not handle them.

   CTABLESRow()
   {

      m_szCatalog[0] = NULL;
      m_szSchema[0] = NULL;
      m_szTable[0] = NULL;
      m_szType[0] = NULL;
      m_szDesc[0] = NULL;
      m_guid = GUID_NULL;
      m_ulPropID = 0;   // Add this line.

   }

BEGIN_PROVIDER_COLUMN_MAP(CTABLESRow)

   PROVIDER_COLUMN_ENTRY("TABLE_CATALOG", 1, m_szCatalog)
   PROVIDER_COLUMN_ENTRY("TABLE_SCHEMA", 2, m_szSchema)
   PROVIDER_COLUMN_ENTRY("TABLE_NAME", 3, m_szTable)
   PROVIDER_COLUMN_ENTRY("TABLE_TYPE", 4, m_szType)
   PROVIDER_COLUMN_ENTRY("TABLE_GUID", 5, m_guid)
   PROVIDER_COLUMN_ENTRY("DESCRIPTION", 6, m_szDesc)
   PROVIDER_COLUMN_ENTRY("TABLE_PROPID", 7, m_ulPropID) //Add this line.

END_PROVIDER_COLUMN_MAP()

};
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

REFERENCES

Microsoft Developer Network Help; search on: "TABLES rowset"

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbcode kbConsumer kbDatabase kbDSupport kbDTL kbMDACNoSweep kbVS600sp3fix KB201387