Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sp_OA procedure crashes SQL Server

Status
Not open for further replies.

shmiller

Programmer
Joined
Aug 16, 2001
Messages
103
Location
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top