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.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 dll call with arguments

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 calldll
as
begin
declare @hr int
declare @object int
declare @return varchar(255)
declare @productid int
declare @@delaylength datetime
declare @padurl varchar(100)
declare @src int
declare @desc varchar(1000)

DECLARE @@RETURNINFO varchar(255)
BEGIN
set @@returninfo='0:0:30'

END

declare user_cursor cursor for (select top 1 productid,padurl from tblproddetails where padurl is not null and padmaincat is null)
open user_cursor

fetch next from user_cursor
into @productid,@padurl

while @@fetch_status=0
begin
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 @object
fetch next from user_cursor
into @productid,@padurl
end
close user_cursor
deallocate user_cursor
end
go
-----------


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 specified
exec @hr= sp_oamethod @object,'cpoll.StorePAD' ,@returnval, 'http://www.deskshare.com/sev.xml', '120'
Go to Top of Page

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.
Go to Top of Page

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.
Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-10-31 : 08:29:09
thanks null was the solution
thanks a lot ehorn.

The Judgement of the Judge is as good as the Judge.
Go to Top of Page
   

- Advertisement -