Domanda

I am trying to follow the tutorial http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data.

When I am trying the update-database command in PM console, i get the following error.

Cannot attach the file 'D:\ASPdotNet\ContosoUniversity\ContosoUniversity\App_Data\ContosoUniversity.Models.SchoolContext.mdf' as database 'ContosoUniversity.Models.SchoolContext'.

Nessuna soluzione corretta

Altri suggerimenti

Just ran into the exact same issue. To resolve I used,

Open the "Developer Command Propmpt for VisualStudio" under your start/programs menu and run the following commands:

sqllocaldb.exe stop v11.0
sqllocaldb.exe delete v11.0

Rebuild the solution and try to update the database again.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top