Problem while changing the connection string in Data Environment

Problem while changing the connection string in Data Environment

Post by ala » Thu, 10 Oct 2002 12:31:30

Dear all,

I've some question while changing connection string in Data
Environment.The situation is that, there are two different Access
file(which contain same tables) for two different user(USER A and USER

The connection string is as follows:

deMain.cnnSeibu.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Persist
Security Info=False"
The path in the connection string will change while using different

The problem is that, when I first use "USER A" database to select the
data on  TABLE A and then I change to use "USER B" database. There is
no problem when I select data on the table other than TABLE A. But
when I also use TABLE A, the error will occur:

run-time error "3709"
The connection cannot be used to perform this operation. It is either
closed or invalid in this context

Why this problem occur?? and what I can do??



Problem while changing the connection string in Data Environment

Post by Rames » Fri, 11 Oct 2002 01:58:00

I have seen this problem happening when we do not reset the active
connection of the command objects after opening the new connection.
When you switch between databases are you closing the connection object in
Data environment?

I would definitely try setting the activeconnection property of the command
object to the new connection once you get the new connection.

Hope this helps.

Ramesh Thyagarajan, MCSD,MCDBA
Microsoft Developer support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit


1. Connection: changing connection string in data environment

Is it normally possible to change the connection string of a connection that
is part of a data environment?
The connection has a connection string already set in the development
environment but we wish to use an udl file in the production environment.
This file could then be changed without having to modify the program code.
When I try to connect using
    dataenvironment.Connection1.Open "File Name=" & "file.udl"
I get the error message  no 3001 saying that the parameters are not valid or
in conflict with other parameters or out of authorized limits.
This command works well with a connection object declared in code.
Is there a solution to this problem?  Or the connection cannot be changed?
Thank you very much,
Jean Trudel

2. Repair Reflex 2.0 files

3. Changing Data Environment Connection String

4. Please give me suggestions of Replication and Stored procedure type update

5. Data Environment and setting the connection string via code

6. ANN: OpenLink Release Virtuoso Enterprise Editon 1.1

7. Changing Data Environment Connection at runtime

8. Changing Database Connection In Data Environment

9. Deploying ADO Data bound controls / changing connection string

10. Change connection string problems

11. HELP Please!- Data Environment connection problem

12. Data Environment / Data Report / Changing database file at run time