Link to home
Start Free TrialLog in
Avatar of Bengtb
Bengtb

asked on

How to change the connectionstring during setup in VB.NET

I am using an oleDbConnection to connect to a MS Access file (mydata.mdb) that uses Connectionstring ....Datasource="c:\data\mydata.mdb"...
I want to give the users ability to change this filepath during setup.
A filedialog box (or something) to browse to a fileshare for example g:\data and then the setup will install/copy the mydata.mdb to g:\data,
and change the datasource path to the same selected fileshare.

I have tested the Application Configuration File withe the following xlm code:
<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
  <appSettings>
    <add key="datasource" value="g:\data" />
      </appSettings>
</configuration>

Example of different installation cenarios:
One company will maybe use a local installation and the datasource value would be "c:\data" (default)
The next company will maybe use a client/server model and the datasource value should point to a datashare ("x:\common")
The next company will maybe use a client/server model and the datasource value should point to a datashare ("f:\dep_data")
and so on...

I want the user/company to select where to put the mydata.mdb during setup ( OR at first application startup )
(Not manually change the configuration file).
ASKER CERTIFIED SOLUTION
Avatar of mmarinov
mmarinov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmarinov
mmarinov

hi Bengtb,

what is wrong with the solution from the given link? Why grade C?

B..G