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
 SQL Server Development (2000)
 using COM objects in stored proc

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-28 : 09:06:18
roy writes "i am trying to use some COM objects in a stored procedure i am writing and have great results until i call a method that returns an object... here is example code:

---------------------------------------------------------
CREATE PROCEDURE spTest
AS

Declare @cn int
Declare @cm int
Declare @rs int
Declare @iRC int
Declare @EOF bit
Declare @source varchar(255)
Declare @Description varchar(1000)

EXEC @iRC = sp_OACreate 'ADODB.Connection', @cn OUT
EXEC @iRC = sp_OACreate 'ADODB.Command', @cm OUT

EXEC @iRC = sp_OASetProperty @cn, 'ConnectionString', 'driver={SQL Server};Data Source=GlobalMerchant;Connect Timeout=10'

EXEC @iRC = sp_OASetProperty @cm, 'ActiveConnection', @cn
EXEC @iRC = sp_OASetProperty @cm, 'CommandText', 'SELECT * FROM Locale'
EXEC @iRC = sp_OASetProperty @cm, 'CommandType', 1

EXEC @iRC = sp_OAMethod @cm, 'Execute', @rs OUT
EXEC @iRC = sp_OAGetErrorInfo @cm, @source OUT, @description OUT
SELECT @description
---------------------------------------------------------

the description of the error is this:
"Error in parameters, or attempt to retrieve a return value from a method that doesn't supply one."

can you tell me what i'm doing wrong?
Thanks,
Roy"
   

- Advertisement -