Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I added an mdf to my project, opened table and some data to it.
Now I tried to make a typed dataset (to attach with my datagridview to display data)
It returns error:

you do not have permission to open this file
Contact the file owner or Administrator

What is that? Who is owner?

Amir Mahfoozi 29-Jan-12 3:44am    
"What is that? Who is owner?" I like your sense of humor ! :)
Member 10482044 22-Dec-13 12:25pm    
I don't know what happened, but I no longer have admin priviliges on my laptop. HELP!! (please?)
Richard MacCutchan 29-Jan-12 3:50am    
Well it's not anyone here.

1 solution

It depends what you mean by "I added an mdf to my project" but it is not usual to include an MDF file in anything.

The problem you are having is that the file is locked and secured for exclusive use by the SQL server process. You could grant yourself permissions (or have the domain admin do this for you if you don't have priviliges to do this), but the chances are you shouldn't be trying to move the mdf file directly.

If you want to move the schema, Visual Studio professional and up has a database project. If you want to move the database you will be better off working with backup files.
Share this answer
Furqan Sehgal 29-Jan-12 6:26am    
Thanks a lot. By adding I mean In Solution Explorer >> Add New Items >> Service-Based Database. Then I added table in Server Explorer.
So I should use backup files if i need to distribute them with my application?

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900