Skip to content

Archive for

21
Mar

FireBootCamp – Gala Day Highlights

FireBootCamp has been an amazing experience.

After 9 weeks of intense training, the FireBootCampers present the solutions that they built during the course, celebrate their successes with a glass of Champagne and mingle with potential employers.

6
Mar

Entity Framework Code First: Delete a LocalDb instance

When working with the Entity Framework Code First I will often get the error below:

An exception of type “System.Data.SqlClient.SqlException’ occurred in EntityFramework.dll but was not handled by in user code’

Additional information: Cannot drop database [database name] because it is currently in use.

To force a delete of the database, follow the steps below.

error_6-03-2014 11-04-30 AM

Figure: This exception is common after you have opened a LocalDb database in Visual Studio.

 

Open Library Package Manager and Stop the LocalDb instance

a: Select Tools | Library Package manager | Package Manager Console

b: Execute the following two statements

                  sqllocaldb stop v11.0

                  sqllocaldb delete v11.0

error_6-03-2014 11-05-59 AM

Figure: The steps above will stop and delete the LocalDb instance.

 

Delete the database file from the database

image

Figure: Open the Solution Explorer and choose Show All Files

error_6-03-2014 11-05-07 AM

Figure: Delete the mdf from the App_Data folder