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
Solved

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

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

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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