Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I m working on the project in vc# connecting to MS Access db. My project is almost complete but i m facing a problem that whenever i m carrying my project to another system i need to keep it 2 the same path as i had it at my system(eg: in my system i have made this project under the folder D:\proj.) So on each and every system i need to keep my project under this location only.

Please assist me by telling the exact location where i should keep my DB so that whenever i m carrying my project to another system, it should work fine irrelevant of the location where i have kept it.

:(

Also Please tell me the connection string for it.

Bye
Posted

I would advice you one of the following:
1. In the application folder (where your exe is located): then you can write as follows: .\mydb
2. In the User\AppData folder. You can use google and find how to use it.
 
Share this answer
 
I think you might create one installer that places the db to the target location.

Or you might also use app.config to define the path of the file where it is located.

Generally we place the database file in the same folder as to have better access. You might also use any path. Just place it anywhere where you want and edit app.config with path of the file:

<br />
<appSettingss><br />
<add key="dbPath" Value="C:\x\y\db.mdb">



Now in your code replace the filepath in the connection string with
ConfigurationSettings.AppSettings ["dbPath"];

:thumbsup:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900