?
Solved

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

Posted on 2002-07-30
6
Medium Priority
?
1,896 Views
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")
    cn1.open ....
cn1.BeginTrans
for i= 1 to x


empDesc=FindIdDescrption(ID,cn1)
response.write empDesc


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

next
cn1.CommitTrans

Function FindIdDescription(tmpCode,tmpcn1)
  Dim rstemp

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

End Function

How to solve this problem?
0
Comment
Question by:leo_wh_cheung
[X]
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
6 Comments
 
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  
http://www.experts-exchange.com/mssql/Q_12010641.html
ASP command change to  Java Command Date: 06/06/2001 03:09AM PST  
http://www.experts-exchange.com/java/Q_20130580.html
Zip a file in Active Server Pages Date: 01/30/2001 02:01AM PST
http://www.experts-exchange.com/asp/Q_20065389.html
How can I set the page never timeout expired? Date: 11/30/2000 08:06PM PST  
http://www.experts-exchange.com/webdevsoftgen/Q_12037560.html

Thanks,
Anthony

0
 
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.
0
 
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
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q272358&

Thank you for maintaining your open questions,
Anthony
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Accepted Solution

by:
CFXPERT earned 1000 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.
0
 

Author Comment

by:leo_wh_cheung
ID: 7208460
CFXPERT,

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.

Thanks!

Leo
0
 
LVL 5

Expert Comment

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

:)
KWK
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

771 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