Solved

ODBC Error Code = 25000 - BEGIN TRAN with no END TRAN

Posted on 2001-08-20
1
1,814 Views
Last Modified: 2013-12-24
ODBC Error Code = 25000 (Invalid transaction state)

[Microsoft][ODBC SQL Server Driver][SQL Server]Transaction count after EXECUTE indicates that a COMMIT
or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.

SQL = "exec StartTransaction"

Is there any way to avoid this error. I am using ColdFusion to program an app and I need to have several
statements encapsulated into a transaction, just to make sure that if an error occurs during the way,
I can rollback to the very biginning of these statements...

I do understand what the error states, but I have no way of combining these statements into a single
stored procdure or sequence of commands... All statement are datat dependent and generated on the fly
using info from previous statements...

StartTransaction is a simple stored procedure stating "BEGIN TRAN"... I do call another stored procedure
with "COMMIT TRAN", but MS SQL 2000 gives this error as soon as StartTransaction finishes...
0
Comment
Question by:polygon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
tleish earned 300 total points
ID: 6406671
Have you tried <CFTRANSACTION>?

Most relational database systems contain locking protocols that dynamically execute whenever a transaction is performed. Row-level locking ensures data consistency within a table record should two (or more) change requests occur simultaneously referencing elements in the same table row. In desktop application development, this is useful in scenarios where information is being entered directly into a table with changes being constantly refreshed to other users' screens.

Some applications, such as Microsoft Excel, employ file or table-level locking. A change request initiates a lock on the entire file or table and prevents editing of any data within the object by other users until the lock is released (see Figure 22.3). The Cold Fusion tag <CFTRANSACTION> implements locking based on the default scheme of the particular ODBC driver being employed.


The following example shows how <CFTRANSACTION> would be used to ensure that an operation dependent on two queries would not leave the databases in an inconstant state if one operation failed:


<CFTRANSACTION>

<CFQUERY DATASOURCE="Accounts">
 UPDATE Accounts SET Total = Total - #Withdrawal#
 WHERE AccountNum = #AccountNum#
</CFQUERY>

<CFQUERY DATASOURCE="Accounts">
 UPDATE Accounts SET Total = Total + #Withdrawal#
 WHERE AccountNum = #AccountNum#
</CFQUERY>

</CFTRANSACTION>


0

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question