BUG: Cursor Services Are Not Used When Execute( ) Is Called from ICommandText

ID: Q223417


The information in this article applies to:
  • Microsoft Data Access Components versions 2.0, 2.1
  • Microsoft OLE DB, version 2.0


SYMPTOMS

If an OLE DB consumer calls QueryInterface to acquire IRowsetChange from an IRowset interface, the following HRESULT is returned:

hr = -2147467262, 0x80004002 or E_NOINTERFACE
This error means that the rowset or OLE DB provider does not support updatability; that is, the Microsoft Oracle OLE DB Provider. In such cases, the consumer can perform updates using SQL UPDATE statements in ICommandText::Execute() or ICommand::Execute(), or by loading OLE DB cursor services. The OLE DB services can be configured to be loaded by setting DBPROP_INIT_OLEDBSERVICES in the DBPROPSET_DBINIT property as follows:

// Load the OLE DB services.
InitProperties[4].dwPropertyID = DBPROP_INIT_OLEDBSERVICES;
InitProperties[4].vValue.vt = VT_I4;
InitProperties[4].vValue.lVal = DBPROPVAL_OS_ENABLEALL; 
However, after loading the services, you still may receive the E_NOINTERFACE error.


CAUSE

The OLE DB cursor services are not loaded if the IRowset interface is obtained from ICommandText::Execute() without querying for the ICommand interface. Therefore, a QueryInterface on the IRowset for IRowsetChange returns an E_NOINTERFACE HRESULT error. If you query first for ICommand and then get ICommandText from the ICommand, the services are loaded.


RESOLUTION

The OLE DB Services will be loaded if you:

  • Request ICommand and call Execute from that ICommand interface.


  • -or-

  • Obtain ICommandText from an ICommand interface pointer first and then call ICommandText::Execute. For example, request ICommand, rather than ICommandText, from IDBCreateCommand::CreateCommand(), and then QI that ICommand pointer for ICommandText.


Once the Execute is performed, the OLE DB Services is loaded. A subsequent query for IRowsetChange will succeed.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


REFERENCES

For additional information, please see the OLE DB Services topics in the Data Access SDK 2.1 documentation.

Additional query words:

Keywords : kbDatabase kbOLEDB200bug kbVC kbGrpVCDB kbGrpMDAC kbDSupport kbMDAC200bug kbMDAC210bug
Version : WINDOWS:2.0,2.1
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: May 26, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.