Solved

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

Posted on 2001-08-20
1
1,766 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
1 Comment
 
LVL 2

Accepted Solution

by:
tleish earned 300 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now