FIX: CTABLESRow Missing TABLE_PROPID ColumnID: Q201387
|
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()
};
A required column, TABLE_PROPID, is missing.
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()
};
Microsoft has confirmed this to be a problem in the Microsoft products 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:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
Microsoft Developer Network Help; search on: "TABLES rowset"
Additional query words: kbcode
Keywords : kbservicepack kbATL kbDatabase kbOLEDB kbVC600bug kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : winnt:6.0
Platform : winnt
Issue type : kbbug
Last Reviewed: May 19, 1999