Microsoft KB Archive/217188

= FIX: CCOLUMNSRow Column Names Are Incorrect =

Article ID: 217188

Article Last Modified on 2/24/2004

-

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 Q217188

<div class="symptoms_section">

SYMPTOMS
The OLE DB Provider Templates define the CCOLUMNSRow class assigned to implement OLE DB's COLUMNS rowset. In the Atldb.h header file where this class is defined, the Provider column map for the class contains column names that are different from the OLE DB specification.

NOTE: It has been reported that Intersolv's Reflector looks for columns having the name according to the OLE DB specification, so customers using this product will encounter a problem with providers generated by the wizard.

<div class="resolution_section">

RESOLUTION
This file is located in the C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include directory.

The following shows the incorrect code:

BEGIN_PROVIDER_COLUMN_MAP(CCOLUMNSRow) PROVIDER_COLUMN_ENTRY("TableCatalog", 1, m_szTableCatalog) PROVIDER_COLUMN_ENTRY("TableSchema", 2, m_szTableSchema) PROVIDER_COLUMN_ENTRY("TableName", 3, m_szTableName) PROVIDER_COLUMN_ENTRY("ColumnName", 4, m_szColumnName) PROVIDER_COLUMN_ENTRY("Column",5, m_guidColumn) PROVIDER_COLUMN_ENTRY("ColumnPropID",6, m_ulColumnPropID) PROVIDER_COLUMN_ENTRY("OrdinalPosition",7, m_ulOrdinalPosition) PROVIDER_COLUMN_ENTRY("ColumnHasDefault",8, m_bColumnHasDefault) PROVIDER_COLUMN_ENTRY("ColumnDefault",9, m_szColumnDefault) PROVIDER_COLUMN_ENTRY("ColumnFlags",10, m_ulColumnFlags) PROVIDER_COLUMN_ENTRY("IsNullable",11, m_bIsNullable) PROVIDER_COLUMN_ENTRY("DataType",12, m_nDataType) PROVIDER_COLUMN_ENTRY("Type",13, m_guidType) PROVIDER_COLUMN_ENTRY("CharMaxLength",14, m_ulCharMaxLength) PROVIDER_COLUMN_ENTRY("CharOctetLength",15, m_ulCharOctetLength) PROVIDER_COLUMN_ENTRY("NumericPrecision",16, m_nNumericPrecision) PROVIDER_COLUMN_ENTRY("NumericScale",17, m_nNumericScale) PROVIDER_COLUMN_ENTRY("DateTimePrecision",18, m_ulDateTimePrecision) PROVIDER_COLUMN_ENTRY("CharSetCatalog", 19, m_szCharSetCatalog) PROVIDER_COLUMN_ENTRY("CharSetSchema", 20, m_szCharSetSchema) PROVIDER_COLUMN_ENTRY("CharSetName", 21, m_szCharSetName) PROVIDER_COLUMN_ENTRY("CollationCatalog", 22, m_szCollationCatalog) PROVIDER_COLUMN_ENTRY("CollationSchema", 23, m_szCollationSchema) PROVIDER_COLUMN_ENTRY("CollationName", 24, m_szCollationName) PROVIDER_COLUMN_ENTRY("DomainCatalog", 25, m_szDomainCatalog) PROVIDER_COLUMN_ENTRY("DomainSchema", 26, m_szDomainSchema) PROVIDER_COLUMN_ENTRY("DomainName", 27, m_szDomainName) PROVIDER_COLUMN_ENTRY("Description", 28, m_szDescription) END_PROVIDER_COLUMN_MAP<BR/>

The header file needs to be changed to reflect the correct column names. The following shows the corrected code:

BEGIN_PROVIDER_COLUMN_MAP(CCOLUMNSRow) PROVIDER_COLUMN_ENTRY("TABLE_CATALOG", 1, m_szTableCatalog) PROVIDER_COLUMN_ENTRY("TABLE_SCHEMA", 2, m_szTableSchema) PROVIDER_COLUMN_ENTRY("TABLE_NAME", 3, m_szTableName) PROVIDER_COLUMN_ENTRY("COLUMN_NAME", 4, m_szColumnName) PROVIDER_COLUMN_ENTRY("COLUMN_GUID",5, m_guidColumn) PROVIDER_COLUMN_ENTRY("COLUMN_PROPID",6, m_ulColumnPropID) PROVIDER_COLUMN_ENTRY("ORDINAL_POSITION",7, m_ulOrdinalPosition) PROVIDER_COLUMN_ENTRY("COLUMN_HASDEFAULT",8, m_bColumnHasDefault) PROVIDER_COLUMN_ENTRY("COLUMN_DEFAULT",9, m_szColumnDefault) PROVIDER_COLUMN_ENTRY("COLUMN_FLAGS",10, m_ulColumnFlags) PROVIDER_COLUMN_ENTRY("IS_NULLABLE",11, m_bIsNullable) PROVIDER_COLUMN_ENTRY("DATA_TYPE",12, m_nDataType) PROVIDER_COLUMN_ENTRY("TYPE_GUID",13, m_guidType) PROVIDER_COLUMN_ENTRY("CHARACTER_MAXIMUM_LENGTH",14, m_ulCharMaxLength) PROVIDER_COLUMN_ENTRY("CHARACTER_OCTET_LENGTH",15, m_ulCharOctetLength) PROVIDER_COLUMN_ENTRY("NUMERIC_PRECISION",16, m_nNumericPrecision) PROVIDER_COLUMN_ENTRY("NUMERIC_SCALE",17, m_nNumericScale) PROVIDER_COLUMN_ENTRY("DATETIME_PRECISION",18, m_ulDateTimePrecision) PROVIDER_COLUMN_ENTRY("CHARACTER_SET_CATALOG", 19, m_szCharSetCatalog) PROVIDER_COLUMN_ENTRY("CHARACTER_SET_SCHEMA", 20, m_szCharSetSchema) PROVIDER_COLUMN_ENTRY("CHARACTER_SET_NAME", 21, m_szCharSetName) PROVIDER_COLUMN_ENTRY("COLLATION_CATALOG", 22, m_szCollationCatalog) PROVIDER_COLUMN_ENTRY("COLLATION_SCHEMA", 23, m_szCollationSchema) PROVIDER_COLUMN_ENTRY("COLLATION_NAME", 24, m_szCollationName) PROVIDER_COLUMN_ENTRY("DOMAIN_CATALOG", 25, m_szDomainCatalog) PROVIDER_COLUMN_ENTRY("DOMAIN_SCHEMA", 26, m_szDomainSchema) PROVIDER_COLUMN_ENTRY("DOMAIN_NAME", 27, m_szDomainName) PROVIDER_COLUMN_ENTRY("DESCRIPTION", 28, m_szDescription) END_PROVIDER_COLUMN_MAP

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug 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="moreinformation_section">

MORE INFORMATION
For other changes to Atldb.h, please see the following KB articles:

201387 BUG: CTABLESRow Missing TABLE_PROPID Column

198520 BUG: ATL OLE DB Provider Fails When Called From SQL 7.0 Query

<div class="references_section">