Urgent: Cannot create new connection because in manual or distributed transaction mode.

Posted on 2002-07-30
Last Modified: 2007-11-27
Urgent: 100 more Points will be added if the problems can be solved.

Error occur when execute the following ASP program:

Cannot create new connection because in manual or distributed transaction mode.

Set cn1 = Server.CreateObject("ADODB.Connection") ....
for i= 1 to x

response.write empDesc

cn1.execute "insert table1...."
cn1.execute "update table3"


Function FindIdDescription(tmpCode,tmpcn1)
  Dim rstemp

    set rstemp = server.CreateObject("adodb.recordset")
    sqlstm ="select * from table2 " sqlstm ,tmpcn1
    If not rstemp.eof then
       FindDescription = rstemp("Desc")
       FindDescription = "N"
    End If
    set rstemp=nothing

End Function

How to solve this problem?
Question by:leo_wh_cheung
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
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7188002
Urgent:  Please maintain your open questions:
Query cannot be updated Date: 11/29/2000 01:35AM PST
ASP command change to  Java Command Date: 06/06/2001 03:09AM PST
Zip a file in Active Server Pages Date: 01/30/2001 02:01AM PST
How can I set the page never timeout expired? Date: 11/30/2000 08:06PM PST


LVL 32

Expert Comment

by:Brendt Hess
ID: 7188697
I have a feeling that you oversimplified your ASP code here.  There is a known issue with this type of code, but only if there is an open rs with pending actions when you try to open another rs.

This error only occurs if you use the default Firehose cursor.  You can prevent it by setting something other than a read-only, forward-only cursor on the rsTemp open.
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7188873
Take a look at this article from MSDN:
PRB: SQLOLEDB Allows Only One Connection in Scope of Transaction;EN-US;Q272358&

Thank you for maintaining your open questions,
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Accepted Solution

CFXPERT earned 250 total points
ID: 7189165
If you have a connection already made make sure you close it and set it to nothing before trying to open a new connection.  Just a thought.  I know I've had problems in the past similiar to this one.

Author Comment

ID: 7208460

I solve this problem by the following method:

1. Define(Dim) a local variable in the function. Otherwise, other function can use this variable and error may occur.

2. Create another connection to update the recordset

3. make sure you close it and set it to nothing before trying to open a new connection.



Expert Comment

ID: 7209319
Not a problem.  Glad you got it fixed.


Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

695 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