sql="Provider="+Provider+";Persist Security Info=False;User ID="+uid+";Initial Catalog=master;Data Source=.";
_bstr_t strConnect = _bstr_t(sql);
m_Ado.m_pConnection->Open(strConnect,"","",adModeUnknown);
sql="select spid from master..sysprocesses where dbid=db_id('aa')";
vSQL=_bstr_t(sql);
_RecordsetPtr m_Recordset;
m_Recordset = m_Ado.GetRecordSet(vSQL);
while (!m_Recordset->adoEOF)
{
temp = (TCHAR *)(_bstr_t)m_Recordset->GetCollect("spid");
sql.Format("kill %i",atoi(temp)); //杀掉连接数据库的进程
vSQL=_bstr_t(sql);
m_Ado.ExecuteSQL(vSQL);
m_Recordset->MoveNext();
}
这是程序代码,我做的是数据库还原,需要先kill所有连接数据库的进程,现在程序还原时报错:没有kill自己连接数据库的进程
我想问怎么做才能杀掉自己连接的进程
[求助]如何kill连接数据库的进程?急