数据库的备份:
  -----

SQLServer2Class oSqlServer = new SQLServer2Class();
        oSqlServer.LoginSecure = true;
        oSqlServer.Connect(this.txtServerName.Text.Trim(), this.txtDbLoginName.Text.Trim(), this.txtPwd.Text.Trim());//数据库的名称、数据库的登录名、数据库的密码

        Backup2Class oBack = new Backup2Class();
        oBack.Database = this.txtDbName.Text.Trim();   //要备份的数据库
        oBack.Files = this.txtBackPath.Text.Trim();   //目标文件
        oBack.Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database;
        try
        {
            oBack.SQLBackup(oSqlServer);
            Response.Write("<script>alert('备份成功!');window.location.href='backupdb.aspx'</script>");
        }
        catch
        {
            Response.Write("<script>alert('备份失败!');window.location.href='backupdb.aspx'</script>");
        }
        finally
        {
            oBack = null;
        }



数据库的恢复:
  -----
SQLServer2Class oSqlServer = new SQLServer2Class();
        oSqlServer.LoginSecure = true;
        oSqlServer.Connect(this.txtServerName.Text.Trim(), this.txtDbLoginName.Text.Trim(), this.txtPwd.Text.Trim()); //数据库的名称、登录名、密码
        Restore2Class oRestore = new Restore2Class();
        oRestore.Database = this.txtDbName.Text.Trim();
        oRestore.Files = this.txtBackPath.Text.Trim();
        oRestore.Action = SQLDMO_RESTORE_TYPE.SQLDMORestore_Database;
        try
        {
            oRestore.SQLRestore(oSqlServer);
            Response.Write("<script>alert('恢复成功!');window.location.href='restoredb.aspx'</script>");
        }
        catch
        {
            Response.Write("<script>alert('恢复失败!');window.location.href='restoredb.aspx'</script>");
        }
        finally
        {
            oRestore = null;
        }
   无论备份还是恢复 需要导入一个Interop.SQLDMO.dll的组件. 
   早上看到了<如何用SQLDMO在ASP.NET页面下实现数据库的备份与恢复 >写得非常棒.