asp Access數(shù)據(jù)備份,還原,壓縮類代碼
<!--#include file="Fun.asp" -->
<%
'數(shù)據(jù)庫管理類
class Datas
'備份
public sub Bk()
Set fso=server.createobject("scripting.filesystemobject")
fso.CopyFile Server.MapPath(SiteDataPath),Server.MapPath(SiteDataBakPath)
set fso=nothing
response.Write("<script language=javascript><!--
alert('備份成功!');window.location.href='DataManage.asp'
// --></script>")
end sub
'還原
public sub Rt()
SDPath = server.mappath(SiteDataPath)
SDBPath = server.mappath(SiteDataBakPath)
set Fso=Server.CreateObject("Scripting.FileSystemObject")
if Fso.FileExists(SDBPath) then
Fso.CopyFile SDBPath,SDPath
Set Fso=nothing
response.Write("<script language=javascript><!--
alert('成功:你已經(jīng)成功恢復(fù)數(shù)據(jù)庫!');window.location.href='DataManage.asp?action=rt'
// --></script>")
else
response.Write("<script language=javascript><!--
alert('失敗:請檢查路徑和數(shù)據(jù)庫名是否存在');window.location.href='DataManage.asp?action=rt'
// --></script>")
end if
end sub
'壓縮
public sub Dc()
SDBPath = server.mappath(SiteDataBakPath)
set Fso=Server.CreateObject("Scripting.FileSystemObject")
if Fso.FileExists(SDBPath) then
Set Engine =Server.CreateObject("JRO.JetEngine")
if request("boolIs") = "97" then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath & "_temp.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath & "_temp.mdb"
end if
Fso.CopyFile SDBPath & "_temp.mdb",SDBPath
Fso.DeleteFile(SDBPath & "_temp.mdb")
set Fso = nothing
set Engine = nothing
response.Write("<script language=javascript><!--
alert('成功:數(shù)據(jù)庫已經(jīng)壓縮成功!');window.location.href='DataManage.asp?action=dc'
// --></script>")
else
response.Write("<script language=javascript><!--
alert('失?。簲?shù)據(jù)庫壓縮失敗,請檢查路徑和數(shù)據(jù)庫名是否存在!');window.location.href='DataManage.asp?action=dc'
// --></script>")
end if
end sub
end class
%>
相關(guān)文章
SQL Server--怎樣用ADO在SQL SERVER中建庫,建表
SQL Server--怎樣用ADO在SQL SERVER中建庫,建表...2006-08-08asp實(shí)現(xiàn)的查詢某關(guān)鍵詞在MSSQL數(shù)據(jù)庫位置的代碼
整體而言,這段SQL只適宜用在小型數(shù)據(jù)庫上,ASP中的循環(huán)也沒效率,大庫還是別用了,小庫可以考慮。如果是大庫的話,請聯(lián)系皇子要另外一份牛人寫的SQL查詢語句。2010-04-04用Asp備份與恢復(fù)SQL Server 數(shù)據(jù)庫
用Asp備份與恢復(fù)SQL Server 數(shù)據(jù)庫...2006-08-08set rs=server.CreateObject("adodb.recordset") 的中文詳
這是創(chuàng)建一個(gè)數(shù)據(jù)庫實(shí)例,但是什么是數(shù)據(jù)庫實(shí)例?還有rs這個(gè)東西也不是一個(gè)變量,他在程序里邊rs.update 等操作是如何進(jìn)行的?打開的表示如何接收rs傳過來的數(shù)據(jù)的?2010-08-08asp Access數(shù)據(jù)備份,還原,壓縮類代碼
asp Access數(shù)據(jù)備份,還原,壓縮類實(shí)現(xiàn)代碼,大家可以參考下。2009-11-11asp Driver和Provider兩種連接字符串連接Access時(shí)的區(qū)別
Microsoft OLE DB Provider for ODBC Drivers 錯(cuò)誤 '80040e21' 多步 OLE DB 操作產(chǎn)生錯(cuò)誤。如果可能,請檢查每個(gè) OLE DB 狀態(tài)值。沒有工作被完成。2009-12-12如何在不支持?jǐn)?shù)據(jù)庫的asp主頁上運(yùn)用ado
如何在不支持?jǐn)?shù)據(jù)庫的asp主頁上運(yùn)用ado...2006-09-09為什么ASP中執(zhí)行動(dòng)態(tài)SQL總報(bào)錯(cuò)誤信息?提示語句語法錯(cuò)誤
為什么ASP中執(zhí)行動(dòng)態(tài)SQL總報(bào)錯(cuò)誤信息?提示語句語法錯(cuò)誤...2007-04-04ASP在SQL Server 2000中新建帳號(hào)和權(quán)限
ASP在SQL Server 2000中新建帳號(hào)和權(quán)限...2006-08-08