Article ID: 173848
Article Last Modified on 2/14/2005
BUG #: 17172 (SQLBUG_65)
36455 (SQLBUG_70)
36455 (SHILOH)
DECLARE @object int
DECLARE @oResultSet int
DECLARE @hr int
DECLARE @strInfo char(255)
EXEC @hr = sp_OACreate 'SQLOLE.SQLServer', @object OUT
EXEC sp_OAGetErrorInfo @object
EXEC sp_OAMethod @object,"Connect", NULL, ".", "sa"
EXEC sp_OAGetErrorInfo @object
EXEC sp_OAMethod @object,
"ExecuteWithResultsAndMessages",
@oResultSet OUT,
@Messages=@strInfo OUT,
@Command="print 'Hello'"
EXEC sp_OAGetErrorInfo @object
Public Function DoIt(ByRef ID As Integer) As Integer
DoIt = 1
ID = 109
End Function
The following script attempts to invoke the method but ends with the "Type
mismatch" error.
DECLARE @object int
DECLARE @hr int
DECLARE @iVal int
select @iVal = 1
EXEC @hr = sp_OACreate MyTest.Class1', @object OUT
EXEC sp_OAGetErrorInfo @object
EXEC sp_OAMethod @object, "DoIt", NULL, @iVal OUTPUT
EXEC sp_OAGetErrorInfo @object
go
Additional query words: data type VB ole automation
Keywords: kbbug kbcode KB173848