0

I'm building my first ASP.NET MVC application using the code-first approach.

When I changed the default connection string's "Data Source" from:

Data Source=(LocalDb)\v11.0

to

Data Source=.\Sqlexpress

I encountered error about an error contains this:

A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

When I reverted the changes I made to "Data Source" it worked.

Why did this happened ? Do I have always to use this data source ?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dabbas
  • 3,112
  • 7
  • 42
  • 75

1 Answers1

0

Try to delete the local db and let code first create it. The message is very clear you have to instruct EF to createIfNotExists.

Oualid KTATA
  • 1,116
  • 10
  • 20