SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 dll call with arguments
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

harshal_in
Aged Yak Warrior

India
633 Posts

Posted - 10/31/2003 :  07:56:56  Show Profile  Visit harshal_in's Homepage  Send harshal_in a Yahoo! Message
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
Flowing Fount of Yak Knowledge

USA
1631 Posts

Posted - 10/31/2003 :  08:02:10  Show Profile
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'

Edited by - ehorn on 10/31/2003 08:02:54
Go to Top of Page

harshal_in
Aged Yak Warrior

India
633 Posts

Posted - 10/31/2003 :  08:14:15  Show Profile  Visit harshal_in's Homepage  Send harshal_in a Yahoo! Message
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
Flowing Fount of Yak Knowledge

USA
1631 Posts

Posted - 10/31/2003 :  08:16:25  Show Profile
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

India
633 Posts

Posted - 10/31/2003 :  08:29:09  Show Profile  Visit harshal_in's Homepage  Send harshal_in a Yahoo! Message
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000