My C# desktop application when run from Windows Guest Account gives this error while accessing SQLLocalDB: "failed to update database "C:ProgramDatamyDB.mdf" because the database is read-only." (I placed the DB in ProgramData to make it accessible to all users)
When run from Windows Administrator Account there is no problem.
The Application is installed on the computer through a SETUP Installer project (NOT CLICKONCE, because Clickonce apps are only accessible on the Windows User account that installed it. I want this app to be accessible to all Windows users on the same machine).
The Installer also installs SQL Server 2016 Express LocalDB.
The application uses a single Database for all Windows users (on the same machine). This is a home business app, meant to be installed by end user without any professional help. If it is possible, how do I go about it?
EDIT: It seems to be a Windows permissions problem, because when Run as Administrator from the Guest Account, the app works. No more errors. But is there a way to set this automatically, perhaps during SETUP/install?
question from:
https://stackoverflow.com/questions/66046210/why-cant-my-vs2019-c-sharp-application-access-a-sqllocaldb-database-file-when-r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…