Solved

Error: more than one hdbc connection in use

Posted on 1999-01-12
5
508 Views
Last Modified: 2013-12-25
When I try to do a "BeginTrans" for a Connection
(f.e. frmMain.gcnProgramManagement.BeginTrans)
I get the always following error:
Can not start transaction because more than one hdbc connection in use.
Error Nr.: -2147168227 / 8004d01d

What's the problem and how can i fix it?
0
Comment
Question by:gautschi
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
cognition earned 150 total points
ID: 1498951
I am guessing you are using rdo.

You have another transaction open, or the connection still has not finished processing the last command.

For example if you return a resultset, and loop through it, but stop half way, and then try and issue another command you will get this error.

This especially happens, if you start using asynchronous cursors, and start one query, and then try another. To do two queries at the same time you will need two connections.

You either need to ensure that you pull all the data back, or set the resultset to nothing. You can also try using a different cursor type/driver. Forward Only, ReadOnly.


0
 

Author Comment

by:gautschi
ID: 1498952
I'm using ADO. and as far as i know i have just one recordset open. i can't use a ReadOnly cursor, because i have to update the recordset.

I wanna do sth like that
conn.BeginTrans
  rs.Update
conn.CommitTrans

If it would help you I can send you an example code.
0
 
LVL 3

Expert Comment

by:cognition
ID: 1498953
When you open the recordset, do you return all the rows you are going to operate on, before you start updating?

Are you returning multiple rows ?
Can you send a bit more code, that recreates the error ?
0
 

Author Comment

by:gautschi
ID: 1498954
Sorry - you were right - I had still a recordset open that wasn't closed :( anyway, thanks for your help! (btw: why can't I have 2 recordsets open and do a BeginTrans, at the same time?)
0
 
LVL 3

Expert Comment

by:cognition
ID: 1498955
Becasue the first recordset is still using the connection to retrieve data.

You can have multiple recordsets open, just not retrieve the data for them at the same time.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

937 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now