Server Error in '/' Application.
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 t开发者_JS百科he 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:
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.
Go to App_Data folder and uncheck the readonly attribute from file REPORT_DB.MDF
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.
See that:
- Your aspnet user has the modify rights on your App_Data folder
- Check the file read/write attribute; right click and see if its not marked as readonly.
精彩评论