Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-10-31 : 07:56:56
|
I have to call a dll ,the function in the dll expects two input parameters and there is one output parameter.when I try to call the dll it gives me the following error:sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]here is my code:alter procedure calldllasbegindeclare @hr intdeclare @object intdeclare @return varchar(255)declare @productid intdeclare @@delaylength datetimedeclare @padurl varchar(100)declare @src intdeclare @desc varchar(1000)DECLARE @@RETURNINFO varchar(255)BEGIN set @@returninfo='0:0:30' ENDdeclare user_cursor cursor for (select top 1 productid,padurl from tblproddetails where padurl is not null and padmaincat is null)open user_cursorfetch next from user_cursorinto @productid,@padurlwhile @@fetch_status=0begin exec @hr=sp_oacreate 'CPollXML.clspollfile' ,@object out exec sp_oageterrorinfo @object,@src out,@desc out SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc IF @hr <> 0 select 'can not create object' exec @hr= sp_oamethod @object,'cpoll.StorePAD' ,'http://www.deskshare.com/sev.xml', '120' EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc IF @hr <> 0 BEGIN select 'harshal' EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc end -- WAITFOR DELAY @@DELAYLENGTH exec @hr=sp_oadestroy @objectfetch next from user_cursorinto @productid,@padurlendclose user_cursordeallocate user_cursorendgo-----------I am not able to find what is wrong please help.regards,harshal.The Judgement of the Judge is as good as the Judge. |
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-10-31 : 08:02:10
|
exec @hr= sp_oamethod @object,'cpoll.StorePAD' ,'http://www.deskshare.com/sev.xml', '120'It appears no output param is specifiedexec @hr= sp_oamethod @object,'cpoll.StorePAD' ,@returnval, 'http://www.deskshare.com/sev.xml', '120' |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-10-31 : 08:14:15
|
could you please elaborate more ,I tried it but did not work The Judgement of the Judge is as good as the Judge. |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-10-31 : 08:16:25
|
If your method is expecting an output param you must store it in a local variable (ie. @int) otherwise just use null. |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-10-31 : 08:29:09
|
thanks null was the solutionthanks a lot ehorn.The Judgement of the Judge is as good as the Judge. |
|
|
|
|
|
|
|