Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Vista .NET3.5 C# Windows , +
Hi,
 
I've created a database windows application using C#.net.My application is running successfully in windowsXp, but it doesn't properly execute in vista/Windows7 systems.
My application shows a message like "Failed to update .mdf database because the database is read-only" Any one give me a proper solution.
Posted 18-Apr-11 23:03pm
ambarishtv10.5K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First of all:
Any one give me a proper solution.
Well, define 'proper solution'. After that, no need to use bold for it. If you have an issue and you are here for help, please be a little respectful.
 
Now:
"Failed to update .mdf database because the database is read-only"
A simple Google search[^] could had given you many links like this:
Similar discussion[^]
 
based on what you say, and the discussion link above, Win7 & Vista has some extra security layer and you need to give proper permissions to the user who is trying to access the database. It's a security configuration issue.
 
(BTW, I think, you should get the details of this privilege issue in EventViewer logged as an error.)
  Permalink  
Comments
ambarishtv at 19-Apr-11 4:27am
   
Sorry for my bad english.
How to overcome this security configuration issue.
Sandeep Mewara at 19-Apr-11 4:37am
   
Did you go through the link I shared?
 
Further, looks like, Dylan Morley provided you a link. Did you went through his answer too?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Bound to be a permissions issue with Vista not allowing access to \YourProjectPath\App_Data
 
1) Make sure App_Data directory or any contained files does not have file system attribute Read-only set.
 
2) Make sure the user account you are attempting to connect with has modify control over the App_Data directory.
 
Have a look at this thread[^] which has a full step-by-step (that's for ASP.Net, but the principal is the same - just choose a different user account at the end)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

right click on your database in object explorer. select properties. under select a page, select page named Options. set "database read only" property which is under "State" option to False.
  Permalink  
Comments
ambarishtv at 19-Apr-11 4:48am
   
Thanks for replay
Database is not in object browser in visual studio.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hi,
"Failed To Update .mdf Database." Some months before while in a windows project i came through this problem.
I googled enough and found some vital informations which i like share on this topic.
 
I'll put it one by one for easy understanding.
No matter whether its XP, Vista or Windows7. The Solution is all the same.
 
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.
 
Now it'll Work..
 

Thank U,
RAJASEKAR KALIDASSAN
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I got answer...
Moving the data(.mdf)to the ApplicationData shared folder, where end users will have write permissions by default.
 
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString) this code is used to find out the Application folder path in xp,vista,win7
 
Thank you all..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Provided the database is TFS bound, then it should be checked out, or have the read-only flag unset.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

it not working on windows 7.
 

please help me.
 

 
thanks in advance
  Permalink  
Comments
Wes Aday at 14-Apr-12 6:26am
   
This is not an answer to this year old question. If "it not working on windows 7", whatever "it" is, then ask your own question.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

Publish your website without publish copy of App_Data folder
finally copy&paste your developer copy of App_Data folder > webserver
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 5 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100