Microsoft KB Archive/255996

From BetaArchive Wiki

Article ID: 255996

Article Last Modified on 12/5/2003



APPLIES TO

  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft OLE DB 2.0
  • Microsoft OLE DB 2.1



This article was previously published under Q255996

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.

CAUSE

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

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.

STATUS

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


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


Keywords: kbbug kbfix kbmdac250fix kboledb250fix KB255996