Solved

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

Posted on 2001-08-20
1
1,783 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

805 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