?
Solved

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

Posted on 2001-08-20
1
Medium Priority
?
1,894 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 1200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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 security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

862 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