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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sp_OA Stored Procuedures

Author  Topic 

majnoon
Starting Member

26 Posts

Posted - 2003-05-28 : 05:45:36
DECLARE @object int
DECLARE @hr int
DECLARE @property bit--varchar(255)
DECLARE @return varchar(255)
DECLARE @src varchar(255), @desc varchar(255)

-- Create an object.
EXEC @hr = sp_OACreate 'CiscoXMLImport.ImportCiscoXML', @object OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
Return
END


-- Get MINC Cables
EXEC @hr = sp_OAMethod @object, 'UploadFamilyBOOT', 'C:\CiscoXML\Copy of 1137_family_boot_05192003.xml', '[2A1_WsaleFamilyBOOT]', @Property OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
ELSE
BEGIN
print @Property
END






-- Destroy the object.
EXEC @hr = sp_OADestroy @object
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
Return
End


This script is calling a dll which takes an XML file puts its data into a SQL Server table, where 'C:\CiscoXML\Copy of 1137_family_boot_05192003.xml' is the path of an XML file and '[2A1_WsaleFamilyBOOT]' is the name of the table the data is going to.

the CiscoXMLImport.dll has been placed in the WINNT\System32 folder and registered, how ever i keep getting the following error

"sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]"

Can anyone please help

Wishing you a peaceful journey

JCamburn
Starting Member

31 Posts

Posted - 2003-05-30 : 19:25:40
From the information you gave, I assume that UploadFamilyBOOT is a method that returns a boolean. The method takes two arguments, namely an XML file path and a table name (both strings). If this is correct then,

This error:
quote:

"sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]"



Tells you that the order of the parameters in this statement:
quote:

EXEC @hr = sp_OAMethod @object, 'UploadFamilyBOOT', 'C:\CiscoXML\Copy of 1137_family_boot_05192003.xml', '[2A1_WsaleFamilyBOOT]', @Property OUT



is incorrect. it should be:

EXEC @hr = sp_OAMethod @object, 'UploadFamilyBOOT', @Property, 'C:\CiscoXML\Copy of 1137_family_boot_05192003.xml', '[2A1_WsaleFamilyBOOT]'


Go to Top of Page
   

- Advertisement -