Reputation: 37
i tried all the things but im unable to write to database from another pc i am able to read but not able to write any solution ?
Failed to update database "C:\INETPUB\WWWROOT\APP_DATA\REPORT_DB.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\WWWROOT\APP_DATA\REPORT_DB.MDF" because the database is read-only.
Source Error:
Line 29: cmd.Parameters.AddWithValue("@paswd", paswd);
Line 30: cmd.Parameters.AddWithValue("@name", name);
Line 31: cmd.ExecuteNonQuery();
Line 32: con.Dispose();
Line 33:
Upvotes: 0
Views: 2783
Reputation: 174
I had the same kind of error ("Attempt to write a read-only database") after moving my app from XSP to IIS. I was missing Write permission for ASP.NET user on my database file. After adding that persmission everything started to work.
Upvotes: 1
Reputation: 9978
See that:
Upvotes: 0
Reputation: 38553
You need to navigate to that file, right click and select properties. Then uncheck the read only flag. It is simply the file permissions of the MDF file.
Upvotes: 1
Reputation: 2763
Go to App_Data folder and uncheck the readonly attribute from file REPORT_DB.MDF
Upvotes: 1