Results 1 to 8 of 8

Thread: [RESOLVED] Problem with ADODB Command & Stored procedure

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2008
    Posts
    32

    Resolved [RESOLVED] Problem with ADODB Command & Stored procedure

    I have a problem registering parameters for a stored procedure.

    Please see this SP carefully.
    Code:
    CREATE PROCEDURE [dbo].[proc1] @ObjectType numeric AS
     SET NOCOUNT ON
     DECLARE @ObjectID INT
     BEGIN TRANSACTION
       UPDATE tblObject
       SET
           m_lCurrentObjectID = m_lCurrentObjectId + 1,
           @ObjectID = m_lCurrentObjectId + 1
         WHERE
           m_lObjectId = @ObjectType
     COMMIT TRANSACTION
     RETURN @ObjectID
    That's it, we take an input parameter of type : NUMERIC, update a value in table
    Return the updated value as a return value from SP, type INTEGER.

    Now the ADODB portion of the code :
    Code:
    Set command = New ADODB.command
        command.ActiveConnection = myConn
        command.CommandType = adCmdStoredProc
        command.CommandText = "dbo.proc1"
        
        Set param1 = command.CreateParameter("ObjectType", adNumeric, adParamInput, 10)
        
        command.Parameters.Append param1
        param1.Value = 105
        Set param2 = command.CreateParameter("ObjectID", adInteger, adParamReturnValue, 10)
        command.Parameters.Append param2
        command.Execute
    I get an exception : "Mutiple step OLE DB operation generated errors.

    I dont understand why !
    Can someone help me pls...

    Thanks.
    Last edited by Hack; Feb 24th, 2009 at 11:40 AM. Reason: Added Code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width