0

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 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:       
0

4 Answers 4

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Go to App_Data folder and uncheck the readonly attribute from file REPORT_DB.MDF

Comments

1

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.