Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: DB_E_ERRORSOCCURRED When ODBC Driver Returns TABLE_TYPE of More than 15 Characters


View products that this article applies to.

This article was previously published under Q257556

↑ Back to the top


Symptoms

The Microsoft OLE DB Provider for ODBC Drivers method IDBSchemaRowset::GetRowSet() fails with DB_E_ERRORSOCCURRED when an ODBC driver returns a TABLE_TYPE string of more than 15 characters.

The specific error is:
Run-time Error '-2147217887 (80040e21): Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
You may experience this error from ActiveX Data Objects (ADO) with an OpenSchema(AdSchemaTables) method call if a recordset is created with the Microsoft ODBC OLE DB Provider for ODBC Drivers and an ODBC driver that returns a TABLE_TYPE string of at least 16 characters.

↑ Back to the top


Cause

The Microsoft ODBC OLE DB Provider for ODBC Drivers generates an ODBC SQLTable() call to return information about tables in the database being accessed by the ODBC driver. The TABLE_TYPE information is bound to an ANSI character buffer that is 32 bytes in length. Once the information is returned, the provider processes the list of tables for the recordset and automatically converts the ANSI characters to UNICODE, which doubles the size of the string. A character string of 16 bytes is doubled to result in a string, including the null terminator, that is bigger than the initial 32-character buffer. This situation is detected by the ODBC Provider, which then returns "DB_E_ERRORSOCCURRED".

↑ Back to the top


Resolution

You can avoid this problem by restricting the TABLE_TYPE character string returned by the ODBC driver in response to the SQLTable call to 15 characters. An alternative is to avoid using the ADO OpenSchema(AdSchemaTables) method with the Microsoft ODBC OLE DB Provider and an ODBC driver that returns a TABLE_TYPE string longer than 15 characters in response to the SQLTable call.

↑ Back to the top


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 Microsoft Data Access Components (MDAC) 2.6.

↑ Back to the top


Keywords: KB257556, kbmdac260fix, kbfix, kbbug

↑ Back to the top

Article Info
Article ID : 257556
Revision : 3
Created on : 10/17/2003
Published on : 10/17/2003
Exists online : False
Views : 312