0

My windows form is using Access Database. How can i map the connect string to the folder in Program Files For example, my database will be in the following location once installed

C:\Program Files (x86)\Amrit\trial\Database

Is there any proper way to make this work?

Amrit Sharma
  • 1,906
  • 8
  • 45
  • 75
  • 1
    http://www.connectionstrings.com/access – Forte L. Feb 14 '13 at 14:59
  • all you need is here: http://stackoverflow.com/questions/909788/how-to-get-installation-path-of-an-application – Davide Piras Feb 14 '13 at 14:59
  • http://stackoverflow.com/questions/3500829/sql-express-connection-string-relative-to-application-location – Andre Loker Feb 14 '13 at 15:00
  • 2
    No, that's not the proper way, you cannot write to the dbase when it is stored in that location. It needs to go into AppData. Or preferably be stored on a file share so it gets backed-up at least once a day. Access dbases have a knack for getting corrupted easily. – Hans Passant Feb 14 '13 at 15:03
  • Stay away from `Program Files (x86)` or not. This folder should not be used to store program data. In the latest OS like Win7 and Vista you will have many problems accessing this folder and its subfolders also if you are an administrator. Use a different folder like ProgramData or something where you have full read/write permissions – Steve Feb 14 '13 at 15:05

1 Answers1

-1

You can: 1. Add the Connection String to the app.config 2. use ODBC Connection 3. Check it out: All the connection strings types

Jacob
  • 751
  • 1
  • 6
  • 18