BUG: Sp_OA Procedures May Produce "Bad Variable Type" or "Type Mismatch" ErrorID: Q173848
|
When you attempt to call sp_OAMethod, you may receive either of the
following errors:
Error: 0x800200008 Bad variable type
Error: 0x80020005 Type mismatch
To work around this problem, do any one of the following:
Microsoft has confirmed this to be a problem in SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
The following script produces the "Bad Variable Type" error.
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
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
Keywords : kbcode SSrvProg kbbug6.50
Version : WINDOWS:6.5
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 19, 1999