adoutputparam and commit trans

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: dk (anonymous_at_discussions.microsoft.com)
Date: 04/22/04


Date: Wed, 21 Apr 2004 17:41:02 -0700

are there any examples of the correct way to use commit tran in
a stored procedure and then
set an output parameter with the result.

in this example rs does is not a valid object - but the record is commited
in the sql code

ado code

 Set pm28 = .CreateParameter _
    ("outparam", adInteger, adParamOutput)
    .Parameters.Append pm28
        
    Set rs = .Execute

sql code:

IF @@ERROR <> 0
                   BEGIN
                      ROLLBACK Tran TRN_INSERT
                      select @outparam= @@ERROR
                   END
          ELSE
           BEGIN
               COMMIT Tran TRN_INSERT
                select @outparam=0
               --Return 0 --Error -- will be 0 if no errors occurred
           END

tia,
dk



Relevant Pages

  • Transactions and cursors.
    ... I want to wrap a stored procedure in a BEGIN TRAN - COMMIT TRAN and abort if ... any update fails. ... The stored procedure uses a cursor and inserts or updates ... a single row in a single table for each iteration of the cursor. ...
    (microsoft.public.sqlserver.programming)
  • Re: Insert SQL does not work in stored procedure.
    ... I thought the "begin tran" and "commit tran" wraps the insert in an explicit ... >> On one of our development servers I've run into a problem with Insert ... The stored procedure works on other servers and used to work on ... >> BEGIN TRANSACTION ...
    (microsoft.public.sqlserver.programming)
  • How could I use a LookUp Query in a DataTransform Task to reach my goal?
    ... COMMIT TRAN ... I want to use the stored procedure to fill the PK column of this table ... I DO KNOW I could use an "Execute SQL Task" (the easiest and quickest ... Anybody could tell me how could I use a LookUp query in a "Data ...
    (microsoft.public.sqlserver.dts)
  • Sybase Stored Procedure issue
    ... I am using DBI to connect to Sybase and run a stored procedure. ... PRINT must be of type CHAR or VARCHAR. ... LogErrorAndDie ("Sybase Stored procedure p_clearalldown failed ...
    (comp.lang.perl.modules)
  • Re: Muiltiple Stored Procedure Within Transaction
    ... I want all of my transaction code within my stored procedure. ... >>Commit Tran ... > if (success) ...
    (microsoft.public.dotnet.framework.aspnet)