Thursday, November 16, 2006

Exception Details: System.Data.SqlClient.SqlException: Failed to update database.

i would like to share my experience with you all because when you started working with SQL Server Express 2005 you have to encounter probelms like one of which am i going to explain you in this blog entry: hopes it will helps you to not to search it for the same problem throughout days or months, as i have to search it for the solution for many days!

Exception Details: System.Data.SqlClient.SqlException: Failed to update database "c:\hosting\webhost4life\member\abc23\aba\LatestABAWebsite\App_Data\aspnetdb.mdf" because the database is read-only.

This will happen mainly coz of the folder permission that we have to apply for the App_data folder: so to rectify this problem you have to follow these steps:

After selecting the 'properties' on the "App_Data" directory,

1. Select the security tab
2. CLick on Add... under "Group or User names:" table
3. On the next window, select Advanced, another window appears and on this, select or rather click on "find now" and a list of Groups and Users should appear on the bottom table.
4. Click on ASPNET followed by OK, and the same on the next 2 windows.

if you need to enable the security tab in Windows XP Professional you have to uncheck the setting for "Use simple file sharing (recommended)" under the View tab in the Folder Options control panel applet to enable the Security tab to be displayed. after that you can be able to view the security tab when you viewed any folder properties.