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: OLE DB Services Are Not Loaded When Execute() Is Called from ICommandText


View products that this article applies to.

This article was previously published under Q255996

↑ Back to the top


Symptoms

OLE DB Services are used in a variety of ways, and the error that is returned by this bug depends on the situation. This article describes some of the possible uses and the errors that may result. For additional information on how to load the OLE DB Services, click the article number below to view the article in the Microsoft Knowledge Base:
223333� OleDbOrc.exe: Using the OLE DB Cursor Engine Service to Provide Updatability for OLE DB Providers

Using OLE DB Services to Obtain an Updatable Rowset with Providers That Do Not Support IRowsetChange Directly

Some providers do not implement the optional IRowsetChange interface. To modify data, the consumer can either use the SQL statements INSERT, UPDATE, and DELETE in conjunction with the ICommand::Execute or ICommandText::Execute methods, or load OLE DB Services to obtain a client-side, updatable cursor.

When OLE DB Services are loaded, the consumer can request the IRowsetChange interface with providers that do not natively support it. The Microsoft OLE DB Provider for Oracle is an example of a provider that does not support the IRowsetChange interface natively. However, if the consumer calls the ICommandText::Execute method, the OLE DB Services may not be loaded. When the consumer then queries for the IRowsetChange interface, the following error is returned:
hr = -2147467262, 0x80004002 or E_NOINTERFACE

Using OLE DB Services to Obtain a Scrollable or Updatable Rowset When the Rowset is Returned by a Stored Procedure

The Microsoft OLE DB Provider for SQL Server cannot return a scrollable or updatable rowset when the rowset is returned by a stored procedure that contains anything other than a single SELECT statement. For additional information on this problem and its resolution, see the following article:
241639� PRB: Errors Occurred Error When Calling Stored Procedure with More than a SELECT Statement
The consumer can load OLE DB Services in order to obtain a scrollable or updatable rowset. However, if the consumer calls the ICommandText::Execute method, the OLE DB Services may not be loaded, and the call may fail with the following error:
hr = -2147217887, 0x80040e21 , DB_E_ERRORSOCCURRED
This error is returned because the provider attempts to open a server-side cursor on the stored procedure call.

↑ Back to the top


Cause

The OLE DB Services are not loaded if ICommandText::Execute is called without requesting the ICommand interface first.

↑ Back to the top


Resolution

To resolve this problem, upgrade to Microsoft Data Access Components (MDAC) 2.5.

If you are using a version of MDAC earlier than version 2.5, there are two ways to work around the problem:
  • Request ICommand and call Execute from that ICommand interface. -or-

  • Obtain ICommandText from an ICommand interface pointer, and then call ICommandText::Execute. For example, request ICommand, rather than ICommandText, from IDBCreateCommand::CreateCommand, and then use the QueryInterface method to obtain that ICommand pointer for ICommandText.
Once the Execute is performed, the OLE DB Services are loaded.

NOTE: If OLE DB Services are loaded, Msadce.dll is loaded from C:\Program Files\Common Files\System\msadc\Msadce.dll by default. If Msadce.dll is not loaded when ICommand::Execute or ICommandText::Execute is called, OLE DB Services were not loaded.

↑ Back to the top


Status

This problem was corrected in Microsoft Data Access Components version 2.5.

↑ Back to the top


References

223333� OleDbOrc.exe: Using the OLE DB Cursor Engine Service to Provide Updatability for OLE DB Providers
241639� PRB: Errors Occurred Error When Calling Stored Procedure with More than a SELECT Statement

↑ Back to the top


Keywords: KB255996, kboledb250fix, kbmdac250fix, kbfix, kbbug

↑ Back to the top

Article Info
Article ID : 255996
Revision : 4
Created on : 12/5/2003
Published on : 12/5/2003
Exists online : False
Views : 427