Changing Data Environment Connection String

Changing Data Environment Connection String

Post by Paul Hasting » Fri, 06 Dec 2002 23:45:23



Hi all-

I have an application that uses a DataEnvironment and MSReports in a
standard exe.

I keep all the connection strings in an INI file so that when I deploy the
program I can change the INI file to connect to different servers with
different names, passwords, etc. I can't seem to do this.

Everything works ok when I work locally but when I create a distributuion
package and deploy to the actual location it seems that I cannot change the
connectionString. When I execute the program on the destination machine it
throws an error "Invalid Data Source".

When I run the code locally in debug mode it seems like I can't really
change the connection string the way I thought I could.

Here is what I am trying to do:

Private Sub DataEnvironment_Initialize()
deKLIF.KLIF.connectionString = csReports  <-- This line doesnt work
End Sub

I am picking up the csReports value from the INI file but it doesnt seem to
"take". When I do it in debug mode locally the value of
deKLIF.KLIF.connectionString is the same before and after the assignment.
The value is the value that I use locally and I cant seem to change it.

Whats up?

Thanks,

Paul Hastings
Principal Computer Scientist
Jorge Scientific Corporation
104 Park Drive
Warner Robins, GA 31088
Voice: (478) 923-2662
FAX: (478) 923-5625

 
 
 

Changing Data Environment Connection String

Post by VBDotNet Team [MS » Fri, 20 Dec 2002 06:09:40


Not sure what's up. I played around with it and I had a local Access
database configured to my dataenvironment. I tried changing the
connectionstring to "foo" and what happened was the entire string remained
the same except for the DataSource key - seems the DE is substituting just
the DataSource but it left the Provider key and others in tact. When I
changed the entire string (all the keywords), it seemed to "take".

Also, at what stage do you call the DE_Initialize code you have below? Are
the connection strings in your ini file completely specified? Are all the
drivers for the provider you are selecting on the deployed machine
available?

Rick
VB Team

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

> Hi all-

> I have an application that uses a DataEnvironment and MSReports in a
> standard exe.

> I keep all the connection strings in an INI file so that when I deploy the
> program I can change the INI file to connect to different servers with
> different names, passwords, etc. I can't seem to do this.

> Everything works ok when I work locally but when I create a distributuion
> package and deploy to the actual location it seems that I cannot change
the
> connectionString. When I execute the program on the destination machine it
> throws an error "Invalid Data Source".

> When I run the code locally in debug mode it seems like I can't really
> change the connection string the way I thought I could.

> Here is what I am trying to do:

> Private Sub DataEnvironment_Initialize()
> deKLIF.KLIF.connectionString = csReports  <-- This line doesnt work
> End Sub

> I am picking up the csReports value from the INI file but it doesnt seem
to
> "take". When I do it in debug mode locally the value of
> deKLIF.KLIF.connectionString is the same before and after the assignment.
> The value is the value that I use locally and I cant seem to change it.

> Whats up?

> Thanks,

> Paul Hastings
> Principal Computer Scientist
> Jorge Scientific Corporation
> 104 Park Drive
> Warner Robins, GA 31088
> Voice: (478) 923-2662
> FAX: (478) 923-5625



 
 
 

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. number of parameters to a stored procedure

3. Problem while changing the connection string in Data Environment

4. Stored procedure problem

5. Data Environment and setting the connection string via code

6. Install Client Tools problem

7. Changing Database Connection In Data Environment

8. xml middleware

9. Changing Data Environment Connection at runtime

10. Deploying ADO Data bound controls / changing connection string

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

12. closing ADO data controls and data environment connections

13. Data environment .close modifies connect string