View Single Post
 
Old 07-23-2013, 05:33 AM
DrPunk's Avatar
DrPunk DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

You don't really want to install the database to the program files folder. This will cause all manner of issues on Windows 7 or later if not run as administrator.

Basically Window 7 (and later) protects files in various folders (Program Files being one of them) from being changed by a User (all applications in Windows 7 are run as User even if the user is an administrator). What will happen with your program is it will not alter the database in the program files folder. Windows will make a copy of that database and put it in the User's Virtual Store folder (C:\Users\[Username]\AppData\Local\VirtualStore) and then Windows will force your program to use that database even though your program will be connecting to C:\Program Files\etc.

It gets seriously confusing because your program will work. It will do stuff to the database. But when you look at the database in the program files folder it will appear as though it hasn't touched the database.

Also, other users using the program will then have their own Virtual copy of the database and so no one will share the data.

For that reason it's best really to use the CommonApplicationData folder (C:\Program Data on Windows 7, although use Environment.SpecialFolder.CommonApplicationData in order to get the operating system's equivalent, i.e. XP's location is different) and create a folder in there for your application to use. Windows 7 won't protect that folder and all users can share the same data source.
__________________
There are no computers in heaven!
Reply With Quote