Has anyone used the sp_OA procedures? sp_OACreate is working fine, but when I try to use sp_OAMethod, it runs and gives me the success message, but crashes the SQL Server. Why would this happen? Especially since I'm using an exe, not a dll, and I'm creating the object with the 4 parameter to specify out-of-process. Here's my code:
DECLARE @object int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
EXEC @hr = sp_OACreate 'SapAutoGui.Event', @object OUT, 4
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
EXEC @hr = sp_OAMethod @object, 'Connect(param1, param2)', null
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
--I also tried the sp_OAMethod line like this
EXEC @hr = sp_OAMethod @object, 'Connect', null, param1, param2
Any help is appreciated.
Thanks,
Shanti
DECLARE @object int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
EXEC @hr = sp_OACreate 'SapAutoGui.Event', @object OUT, 4
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
EXEC @hr = sp_OAMethod @object, 'Connect(param1, param2)', null
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
--I also tried the sp_OAMethod line like this
EXEC @hr = sp_OAMethod @object, 'Connect', null, param1, param2
Any help is appreciated.
Thanks,
Shanti