FIX: sp_OAGetProperty Fails on Properties From Inherited Interface

This article was previously published under Q236440
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 18763 (SQLBUG_65)
55840 (SQLBUG_70)
Using sp_OAGetProperty to retrieve a property value from an inherited COM interface fails. If the property value is requested as an OUTPUT parameter, the following error is returned:
Error: 2147745792 (0x80040000)
Source: ODSOLE Extended Procedure
Message: Error in parameters, or attempt to retrieve a return value from a method that doesn't supply one.
When no OUTPUT parameter is supplied, such that sp_OAGetProperty would generate a result set, the command will return an empty result set.
If an OUTPUT parameter is requested, sp_OAGetProperty must confirm that theinterface supports the call and that it returns a value that is of the same datatype as the one supplied. However, it fails to correctly walk the object hierarchy to determine this information and will generate an error if this occurs.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
Consider, for example, the Command object in Active Data Objects (ADO). In ADO 2.x, the Command object inherits from an interface named _Command15, which was the ADO 1.5 version of the interface. If sp_OAGetProperty is used to request a property in the base interface, such as Parameters, an error occurs. The following code snippet demonstrates the problem:
exec @hr = master.dbo.sp_OACreate 'ADODB.Command', @ADO_Command OUTif @hr <> 0begin 	print "failed in command creation"	goto fatal_exitend...exec @hr = master.dbo.sp_OAGetProperty @ADO_Command, 'Parameters', @ADO_parms OUTif @hr <> 0begin	print 'Failed in GetProperty'	goto fatal_exitendfatal_exit:...				
The definition of an object can be seen by using a tool such as the OLE - COM Object Viewer, available as part of Visual C++.

Article ID: 236440 - Last Review: 10/21/2013 22:54:26 - Revision: 4.0

  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix KB236440