数据库备份与恢复数库备份与恢复.doc
文本预览下载声明
数据库备份与恢复.txt我是天使,回不去天堂是因为体重的原因。别人装处,我只好装经验丰富。泡妞就像挂QQ,每天哄她2个小时,很快就可以太阳了。access,备份和恢复,完整,可用
%
if session(username_tyadmin)= then
response.redirect index.asp
response.end
end if
%
!--#include file=conn.asp --
style type=text/css
!--
body,td,th {
font-size: 12px;
}
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
.STYLE2 {color: #FF0000}
--
/styleBODY topMargin=0 leftmargin=0 marginheight=0
%
db=../xs_data/xs.mdb
If Request.QueryString(action)=back Then
currf=request.form(currf)
currf=server.mappath(currf)
backf=request.form(backf)
backf=server.mappath(backf)
backfy=request.form(backfy)
On error resume next
Set objfso = Server.CreateObject(Scripting.FileSystemObject)
if err then
err.clear
response.write scriptalert(不能建立fso对象,请确保你的空间支持fso:!);history.back();/script
response.end
end if
if objfso.Folderexists(backf) = false then
Set fy=objfso.CreateFolder(backf)
end if
objfso.copyfile currf,backf \ backfy
response.write scriptalert(备份数据库成功);history.back();/script
End If
If Request.QueryString(action)=ys Then
currf=request.form(currf)
currf = server.mappath(currf)
ys=request.form(ys)
Const JET_3X = 4
strDBPath = left(currf,instrrev(currf,\))
on error resume next
Set objfso = Server.CreateObject(Scripting.FileSystemObject)
if err then
err.clear
response.write scriptalert(不能建立fso对象,请确保你的空间支持fso:!);history.back();/script
response.end
end if
if objfso.fileexists(currf) then
Set Engine = CreateObject(JRO.JetEngine)
response.write strDBPath
on error resume next
If ys = 1 Then
Engine.CompactDatabase Provider=Microsoft.Jet.OLEDB.4.0;Data Source= currf, _
Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath tourtemp.mdb; _
Jet OLEDB:Engine Type= JET_3X
Else
Engine.CompactDatabase Provider=Microsoft.Jet.OLEDB.4.0;Data Source= currf, _
Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath tourtemp.mdb
End If
objfso.CopyFile strDBPath tourtemp.mdb,currf
objfso.DeleteFile(strDBPath tourtemp.mdb)
显示全部