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 trialJoel Brennan
18,300 PointsCannot drop database "" because it is currently in use.
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll
Additional information: Cannot drop database "ComicBookGallery" because it is currently in use.
2 Answers
Calin Bogdan
14,921 PointsHi Joel!
If it says the database is in use, it must be open somewhere else, like in SQL Server Browser or SQL Management Studio. If not, remember to check Close existing connections in the delete database dialog, like so:
Let me know if it worked for you.
Kevin Gates
15,053 PointsIf you get that Close Existing Connections, first close all of your C# tabs first in Visual Studio, then run. That fixed it for me.
Joel Brennan
18,300 PointsJoel Brennan
18,300 PointsHi Thanks. I looked in SQL Management Studio, but I cannot see the connection listed to LocalDB.
** I was able to locate by: SqlLocalDB.exe i MSSQLLocalDB And connecting to the Instance pipe name.
All working now thanks.