You must Sign In to post a response.
  • Category: Visual Studio

    Database is read-only

    Hi,

    I had developed windows application with C# and converted to EXE file.When i install that exe to windows 7 i got this error when i run that project.

    "Failed to update database "c:\Program Files\Test\Test.mdf" because that database is read-only."

    but if we install with windows xp it is working good.

    Can any one please help me it is very urgent?



    thanks and regards

    Ram.
  • #762146
    Hi

    Check your System Profile.

    try to install Administrator Role.

    Right click -> Run as Administrator.

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762151
    Hello RAM,

    Follow the below steps :

    1. Just go to the program files and find the folder of the installed program.
    2. Just right click the .mdf file in the folder and click PROPERTIES.
    3. In PROPERTIES TAB -> SECURITY -> you'll see Group or Usernames.
    4. In that select the User to which u want to give Access to the file.
    5. If for that user the PERMISSION is not set to FULL CONTROL.
    6. TO CHANGE PERMISSIONS -> CLICK EDIT.
    7. Now the Group or Username box will open.
    8. In that Select The User -> Select FULL CONTROL in Permission Box.
    9. Now follow the steps for the log file too. IF Needed.


    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762154
    Hi Ram,

    Please check the permission level, I think you don't have permission to the specified path or database which you are trying to update. First off all run your script with Administrator privileges.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #762175
    Hi,

    Yes it is working if we set permission for installed program but i do not want to update any thing after installed program.Please is there any other way?.

  • #762178
    Hello Ram,

    Some things are there which could have change after installation it it violates windows security, than you should have change the permission for accessing such secured files.

    Hope you understand.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #766577
    Hi,

    Kindly change your database access rights to normal mode as following steps

    1. Open SQL Server Query window from the SSMS
    2. Write a query and execute it

    Example:

    Use [DatabaseName]
    Go
    Alter Database [DatabaseName] set Read_Write with No_Wait


    After, executing the above query your database will change normal mode.

  • #766583
    If you install SQL server in the "C"/OS Installed drive you may face this issue.
    Either you can change the SQL server data in the other drive or you can give the permission to access for the MDF file.

    Right click the .mdf file and click PROPERTIES.
    Go to PROPERTIES TAB -> SECURITY
    Select the User to Access to the DB file.
    Check PERMISSION is set to FULL CONTROL

    By Nathan
    Direction is important than speed


Sign In to post your comments