Microsoft KB Archive/236440

From BetaArchive Wiki
Knowledge Base


FIX: sp_OAGetProperty Fails on Properties From Inherited Interface

Article ID: 236440

Article Last Modified on 3/14/2006



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition



This article was previously published under Q236440

BUG #: 18763 (SQLBUG_65)
55840 (SQLBUG_70)

SYMPTOMS

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.

CAUSE

If an OUTPUT parameter is requested, sp_OAGetProperty must confirm that the interface 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.

STATUS

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.

MORE INFORMATION

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 OUT
if @hr <> 0
begin 
    print "failed in command creation"
    goto fatal_exit
end

...

exec @hr = master.dbo.sp_OAGetProperty @ADO_Command, 'Parameters', @ADO_parms OUT
if @hr <> 0
begin
    print 'Failed in GetProperty'
    goto fatal_exit
end

fatal_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++.


Additional query words: sp_OAMethod

Keywords: kbbug kbfix KB236440