I have a WPF application and I'm using SQL Server CE on it. It works fine when debugging with Visual Studio, but when I install the application in any computer, an error message is shown saying:
Access to the database file is no allowed
and the path of my database(usually the folder where the application was installed C:/ProgramFiles).
The folders C:\program files or C:\program files (x86) cannot be used to store writable elements of an application like a database file. This is a security change made in Vista and in Win7 (UAC).
You should choose a different location (MyDocuments, ProgramData or else) where to store your database file during setup.
When you debug in Visual Studio, you are running your application inside the Solution Directory and subfolder bin\debug where you have read/write permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With