Cannot drop database because it is currently in use

后端 未结 17 1437
北恋
北恋 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条回答
  •  -上瘾入骨i
    2020-12-07 12:40

    Someone connected to the database. Try to switch to another database and then, to drop it:

    Try

    SP_WHO to see who connected

    and KILL if needed

提交回复
热议问题