Click here to Skip to main content
16,019,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm working on windows application using entity framework. Which uses local database from AppData folder of application. It is the sqlexpress database.

When I run my application , it creates database connection using the mdf file but some times it shows the errror.

Cannot open database "C:\PROGRAM FILES (X86)\DIRECT SELLER SOLUTION\DIRECT SELLER SOLUTION\APP_DATA\MYDB.MDF" requested by the login. The login failed.
Login failed for user 'MGC013\admin'.


Most important thing is , it not happens all the time and on all the machines. some time it works fine. so I can not understand the reason behind it. may be some user restriction or some database connections limit issue but I don't know where to give permission and whom.

Please help .......
Posted

1 solution

It's likely that it's a permissions problem - and the best solution is never to keep data files in your application folder! Have a look here: Where should I store my data?[^] it shows some more appropraite places, and explains how to access them.
 
Share this answer
 

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