How do I gain permissions to a Sql Compact Database?
I have an Sql Compact Database v3.5 that I'm bundling with my application. When the application is installed, the database is copied into the application's Program Files directory.
Because of Vista and Win7's security settings, the installed application can't access the database file. It is merely a problem of having the database file reside in the Program Files.
The solution I开发者_运维百科 have thought of is to copy the file into Program Data, but does anyone have another solution? I am sure others have come across a similar problem.
Thanks in advance for your input.
store the application data in the user's application data directory. Or in 'default user'. The user has permission to this directory and that is the intended purpose.
http://blog.kowalczyk.info/article/Getting-user-specific-application-data-directory.html
Use the Environment.SpecialFolder
property. Place the DB file either in the app data all users or app data of the specific user.
Probably will need some setting at install like most applications these days.
精彩评论