Microsoft KB Archive/201387

= FIX: CTABLESRow Missing TABLE_PROPID Column =

Article ID: 201387

Article Last Modified on 10/15/2002

-

APPLIES TO

 Microsoft OLE DB 2.7, when used with:  Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Standard Edition 

-

<div class="notice_section">

This article was previously published under Q201387

<div class="symptoms_section">

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

};

<div class="cause_section">

CAUSE
A required column, TABLE_PROPID, is missing.

<div class="resolution_section">

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

};

<div class="status_section">

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

<div class="references_section">