Exemplo n.º 1
0
 public static DataTable GetAllBackupHistory()
 {
     try
     {
         TopFashion.SQLDBHelper SqlHelper = new TopFashion.SQLDBHelper();
         string    sql = "select * from Record order by ID desc";
         DataTable dt  = SqlHelper.Query(sql, true);
         return(dt);
     }
     catch (Exception e)
     {
         TopFashion.WriteLog.CreateLog("数据库操作", "GetAllBackupHistory", "error", "获取备份的历史记录失败:" + e.Message);
         return(null);
     }
 }
Exemplo n.º 2
0
        private static void KillProcess(string DbName)
        {
            string sql = "select spid from sys.sysprocesses where dbid in (select dbid from master..sysdatabases where name = '" + DbName + "')";

            TopFashion.SQLDBHelper SqlHelper = new TopFashion.SQLDBHelper();
            DataTable dt = SqlHelper.Query(sql);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    try
                    {
                        SqlHelper.ExecuteSql("kill " + dt.Rows[i][0].ToString());
                    }
                    catch { }//避免KILL自身进程造成错误!
                }
            }
        }