A restore can only happen if the database does not have any connections to it (besides yours). The easy way on a MS SQL Server to kick all users off is:
ALTER DATABASE [MyDB] SET Single_User WITH Rollback Immediate
GO
Now, you can perform your restore with impunity. Make sure you set it back to Multi-user mode when you're done with the restore:
ALTER DATABASE [MyDB] SET Multi_User
GO
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…