Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,350 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,206 Points

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