Cannot drop database because it is currently in use

后端 未结 17 1438
北恋
北恋 2020-12-07 11:50

I want to drop a database. I have used the following code, but to no avail.

public void DropDataBase(string DBName,SqlConnection scon)
{
    try
    {
               


        
17条回答
  •  独厮守ぢ
    2020-12-07 12:50

    just renaming the DB (to be delete) did the trick for me. it got off the hold of whatever process was accessing the database, and so I was able to drop the database.

提交回复
热议问题