C# Entity Framework Basics Extending Our Entity Data Model Populating Your Database with Seed Data

Itay Tur
Itay Tur
2,392 Points

how to use the The sql server explorer without getting an exception when running the program

the program runs fine up until i check the database in the server explorer. in this point if i i run the program i get this exception: "System.Data.SqlClient.SqlException: 'Cannot drop database "Books" because it is currently in use.' " while all my models tabs are closed

2 Answers

Dale Severude
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,298 Points

Close any table or data views open in Visual Studio. Any windows 'in use' can block CRUD operations to your database. If you get this error, then there is a window 'in use' somewhere that needs to be closed.

Marek Ott
Marek Ott
9,204 Points

Another possible solution of this problem is (after closing all windows as Dale wrote) running VS as an administrator.