• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

where should I save my database when I deploy my project


I have a C# project which has an Access db. Now for testing I have stored it in my C:\temp folder.
But what is the best place to place the db when I deploy my project? My Documents folder? Or Program Files folder?

  • 2
1 Solution
if you only expect one user to use the program than put it in the users folder


otherwise i guess you could put it in program files... this all depends on security.. if you have active directory users may not be able to save to the c:
Paul ThompsonIT ConsultantCommented:
I don't believe there are any hard and fast rules for the location of an Access database.

However, I'm sure this will be debated...

In general:-

Small, Single user, stand alone application.
Put the database in a Sub-folder below the folder where the .exe resides

MultiUser Application on a single network domain.
A network shared folder created specifically for this application.

Web application.
Sub folder below the web root.

Don't put it in "My Documents" or "Documents". Users will almost certainly re-arrange folders and tidy things up as required. This will break your application. If your database is in "My Documents", users will treat it as one of their own documents they can open and play with. Again, this will break your application. If you don't want users to break your database, its best to hide it away in a folder below the .exe.

If you keep the database with the .exe or in a folder below the .exe, ther will be no confusion that this database belongs to this application.

In larger applications and more formal deployments you would keep the database in:


%AppData% is an environment variable that resolves to:-

In XP and 2000...
C:\Documents and Settings\<username>\Application Data\

In Vista and Windows 7...

Just type %appdata% in your windows explorer to go there and see how other applications have stored data.

Don't hard code the path, you dont know if it's being deployed to XP, Vista or whatever. Always deploy using the %AppData% environment variable in the deployment path.

Hope this helps


Pit76Author Commented:
Thx, great and clear explaination!
I can understand and agree with these recommendations.

Paul ThompsonIT ConsultantCommented:
You may want to take a look at %ProgramData% too.
All users on that machine can access this folder.

%AppData% tends to be user specific.


Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now