因为在分离数据库时,我已经在程序中断开了adoconnection.close.,adotable.close;
等所有连接。
但还
老是提示:
‘数据库在使用中,无法分离!’
怎样才能彻底断开与此数据库的连接(在不重新启动引挚的前提下)???
达到分离数据库的目的!!
谢谢!!
---------------------------------------------------------------
create proc killspid (@dbname varchar(20))
as
begin
declare @sql nvarchar(500)
declare @spid int
set @sql='declare getspid cursor for
select spid from sysprocesses where dbid=db_id('''+@dbname+''')'
exec (@sql)
open getspid
fetch next from getspid into @spid
while @@fetch_status < >-1
begin
exec('kill '+@spid)
fetch next from getspid into @spid
end
close getspid
deallocate getspid
end
--用法
use master
exec killspid '数据库名'