Reputation: 3241
In normal condition, I can add schemas in the dbml file to empty database with code below.
But now when I run this code, I take the error "Cannot drop database "test" because it is currently in use." How can I do it?
Dim db As New UI_Class.UIData
If db.DatabaseExists Then
db.DeleteDatabase()
End If
db.CreateDatabase()
Upvotes: 0
Views: 436
Reputation: 26464
Most likely something is connected to the db.
Common causes are:
Upvotes: 0
Reputation: 36383
It might happen as your SQL Server Management Studio (SSMS) must be holding it.
Upvotes: 1