0

I created.exe file and installed it on another machine.When I insert data I get an error "Failed to update database "Database.mdf" because database file is read-only". I am able to view the data but cannot insert the data. I am using local database and visual studio 2015. My connection string is:

connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='|DataDirectory|\db\Database.mdf';Integrated Security=True;"

I am not sure how to grant all permissions to my database over client machine.Any suggestions?

Ashwini Nemade
  • 153
  • 1
  • 13
  • possible duplicate [Unable to update database .MDF is Read Only](https://stackoverflow.com/questions/25026925/unable-to-update-database-mdf-is-read-only) – Kaj Jun 16 '18 at 12:29
  • the "database read-only" flag for Database.mdf is set to false already. And I am not using any sql server express. I am using localdb with visual studio 2015. I dont know how to give permissions to local database. – Ashwini Nemade Jun 16 '18 at 12:33
  • 1
    Then read here : [Failed to update .mdf database because the database is read-only (Windows application)](https://stackoverflow.com/questions/5713416/failed-to-update-mdf-database-because-the-database-is-read-only-windows-applic) – Kaj Jun 16 '18 at 12:36
  • The file for which I am creating .exe is in read-only mode. I tried to unset it but it sets back to read only mode. – Ashwini Nemade Jun 16 '18 at 13:03
  • I think it's a user privilege, what will happened if you run the app as an administrator? – Kaj Jun 16 '18 at 13:05
  • It gives same error "database is read-only" even if we run the app as administrator – Ashwini Nemade Jun 16 '18 at 13:11
  • The problem with the permissions. You have to get a location where user has read/write permissions to be able to update data. – Kaj Jun 16 '18 at 13:14

0 Answers0