1

I'm using LocalDB and Entity Framework code-first for a new project. I want to change the location where the database is created/saved. However, every time I do, I get one of any number of exceptions. If I try adding AttachDBFilename=|DataDirectory|\database.mdf, I get an exception stating:

The underlying provider failed on Open.

As well as:

Cannot attach the file 'C:\Projects\database.mdf' as database 'Schema.MyProject'.

Eventually, when I run this program on another computer, I'm looking to create/save the database in the AppData folder. How can this be done?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
PiousVenom
  • 6,888
  • 11
  • 47
  • 86

0 Answers0