(纯技术贴)请问一下sqldmo里备份和还原的问题
在还原的时候为了杀死该数据库正在运行的所有进程,所以有下面一段
SQLDMO.QueryResults qr = srv.EnumProcesses(-1);
int iColPIDNum = -1;
int iColDbName = -1;
for (int i = 1; i <= qr.Columns; i++)
{
string strName = qr.get_ColumnName(i);
if (strName.ToUpper().Trim() == "SPID ")
{
iColPIDNum = i;
}
else if (strName.ToUpper().Trim() == "DBNAME ")
{
iColDbName = i;
}
if (iColPIDNum != -1 && iColDbName != -1)
break;
}
&n