Selecting Database Path

T

Tony K

Hi all,
I have an inventory application I'm writing for the company I work for
and realized the path for the Access database might reside on a network
drive. I have used Microsoft's Add Data Source method of adding the db to
the app. How could I customize this so the path can be changed. I found
that the connection is a ReadOnly property and cannot be changed.

Thanks,

Tony K
 
C

Chris

I'm assuming that you're using VB.NET for your application.

When you run the add data source wizard in VS2005, it will create an
application variable called "ConnectionString" in your applications's config
file ("MyInventoryApp.exe.config", for example). That can be changed by any
text editor.

Were you wanting the user to be able to change it via the user interface?
 
T

Tony K

Yes, I was hoping to be able to program say a "Tools" form and allow the
user to select where the database resides then write that info to a config
file or store that path in the registry or something like that.

Tony K
 
T

Tony K

Chris,
How would I access the config file? The filename is
Inventory.exe.config and the info that I would need to access is:

<connectionStrings>
<add
name="Daily_Foods_Inventory.My.MySettings.Inventory_management_databaseConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=&quot;|DataDirectory|\Inventory management database.mdb&quot;"
providerName="System.Data.OleDb" />
</connectionStrings>

Tony K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top