ADO and Transaction in SQL Server 7.0: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. 
Author Message
 ADO and Transaction in SQL Server 7.0: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

HI

The following code works fine:
    pCon.Execute "BEGIN TRANSACTION  Commit Transaction"

But if I do it in two Statements:

    pCon.Execute "Begin Transaction "
    pCon.Execute "Commit Transaction "

I get an error:
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

It seems, that the Trancaction is local to the Execute-Command.

Can somebody help me?

Thanks

Hajo



Sun, 30 Jun 2002 03:00:00 GMT  
 ADO and Transaction in SQL Server 7.0: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
Why do you want to do it in to .Execute statement?
Have you tried using stored procedures?

Regards    PerL


Quote:
> HI

> The following code works fine:
>     pCon.Execute "BEGIN TRANSACTION  Commit Transaction"

> But if I do it in two Statements:

>     pCon.Execute "Begin Transaction "
>     pCon.Execute "Commit Transaction "

> I get an error:
> The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

> It seems, that the Trancaction is local to the Execute-Command.

> Can somebody help me?

> Thanks

> Hajo



Sun, 30 Jun 2002 03:00:00 GMT  
 ADO and Transaction in SQL Server 7.0: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

And you expected....??

Try:

pCon.BeginTrans
' Do some work
pCon.CommitTrans

Mike

Quote:

>HI

>The following code works fine:
>    pCon.Execute "BEGIN TRANSACTION  Commit Transaction"

>But if I do it in two Statements:

>    pCon.Execute "Begin Transaction "
>    pCon.Execute "Commit Transaction "

>I get an error:
>The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

>It seems, that the Trancaction is local to the Execute-Command.

>Can somebody help me?



Sun, 30 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why to use COM+ transaction and not just SQL Server transaction

2. Why to use COM+ transaction and not just SQL Server transaction

3. Using Transactions with SQL-Server 7.0 ?

4. Access97 ADO SQL7 transactions - undefined recordset after COMMIT

5. ADO Begin/Commit Transactions

6. Transactions with SQL Server & ADO

7. SQL Server ADO Transaction Error

8. SQL Server ADO Transaction Error

9. HELP nested transaction under ado sql server

10. SQL Server ADO Transaction Error

11. Transaction scope using ADO with SQL Server 7 and MTS

12. ADODB TRANSACTION ADO ERROR No Transaction is Active

 

 
Powered by phpBB® Forum Software