asp的access数据库管理程序

asp的access数据库管理程序'备份数据库
asp的access数据库管理程序
sub ad_backupdata()
asp的access数据库管理程序    
on error resume next 
asp的access数据库管理程序    bkfolder 
= server.MapPath("../mdbackup/")
asp的access数据库管理程序    bkpath 
= bkfolder&"\"&year(now)&"-"&month(now)&"-"&day(now)&".asp"
asp的access数据库管理程序    dbpath 
= Server.MapPath("../mdbdate/company.mdb")
asp的access数据库管理程序    
Set Fso=server.createobject("scripting.filesystemobject")
asp的access数据库管理程序    
if Err <> 0 Then 
asp的access数据库管理程序        response.write 
"该空间不支持FSO组件,操作失败"
asp的access数据库管理程序    
else
asp的access数据库管理程序        
if fso.FileExists(dbpath) then
asp的access数据库管理程序            
If fso.FolderExists(bkfolder)=false Then fso.CreateFolder(bkfolder)
asp的access数据库管理程序            fso.copyfile dbpath,bkpath
asp的access数据库管理程序            response.write 
"备份数据库成功"
asp的access数据库管理程序        
Else
asp的access数据库管理程序            response.write 
"找不到数据库文件"
asp的access数据库管理程序        
End if
asp的access数据库管理程序    
end if
asp的access数据库管理程序
end sub
asp的access数据库管理程序
asp的access数据库管理程序
asp的access数据库管理程序
'数据库压缩
asp的access数据库管理程序
sub ad_compactdata()
asp的access数据库管理程序    
on error resume next 
asp的access数据库管理程序    dbpath 
= Server.MapPath("../mdbdate/company.mdb")
asp的access数据库管理程序    cdpath 
= server.MapPath("../mdbdate/")&"\temp.mdb"
asp的access数据库管理程序    
Set fso = Server.CreateObject("Scripting.FileSystemObject")
asp的access数据库管理程序    
if Err <> 0 Then 
asp的access数据库管理程序        response.write 
"该空间不支持FSO组件,操作失败"
asp的access数据库管理程序    
else
asp的access数据库管理程序        
If fso.FileExists(dbPath) Then
asp的access数据库管理程序            
Set Engine = CreateObject("JRO.JetEngine")
asp的access数据库管理程序            
set conn=nothing
asp的access数据库管理程序            Engine.CompactDatabase 
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath," Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & cdpath
asp的access数据库管理程序            fso.CopyFile cdpath,dbpath
asp的access数据库管理程序            fso.DeleteFile(cdpath)
asp的access数据库管理程序            
Set fso = nothing
asp的access数据库管理程序            
Set Engine = nothing
asp的access数据库管理程序            response.write 
"数据库压缩成功"
asp的access数据库管理程序        
Else
asp的access数据库管理程序            response.write 
"找不到数据库文件"
asp的access数据库管理程序        
End If
asp的access数据库管理程序    
end if
asp的access数据库管理程序
end sub
asp的access数据库管理程序
asp的access数据库管理程序
asp的access数据库管理程序
'恢复数据库
asp的access数据库管理程序
sub ad_restore()
asp的access数据库管理程序    
on error resume next 
asp的access数据库管理程序    backname
=request.form("backname")
asp的access数据库管理程序    
if backname="" then
asp的access数据库管理程序        response.write 
"请指定的备份文件名"
asp的access数据库管理程序    
else
asp的access数据库管理程序        backpath
=server.MapPath("../mdbackup/")&"\"&backname
asp的access数据库管理程序        
Set Fso=server.createobject("scripting.filesystemobject")
asp的access数据库管理程序        
if Err <> 0 Then 
asp的access数据库管理程序            response.write 
"该空间不支持FSO组件,操作失败"
asp的access数据库管理程序        
else
asp的access数据库管理程序            
if fso.fileexists(backpath) then
asp的access数据库管理程序                fso.copyfile backpath,Server.MapPath(
"../mdbdate/company.mdb")
asp的access数据库管理程序                response.write 
"成功恢复数据库"
asp的access数据库管理程序            
else
asp的access数据库管理程序                response.write 
"找不到指定的备份文件"
asp的access数据库管理程序            
end if
asp的access数据库管理程序        
end if
asp的access数据库管理程序    
end if
asp的access数据库管理程序
end sub
asp的access数据库管理程序
asp的access数据库管理程序
asp的access数据库管理程序
'清理备份数据库
asp的access数据库管理程序
sub ad_deldata()
asp的access数据库管理程序    
on error resume next 
asp的access数据库管理程序    delpath
=server.MapPath("../mdbackup/")
asp的access数据库管理程序    
Set Fso=server.createobject("scripting.filesystemobject")
asp的access数据库管理程序    
if Err <> 0 Then 
asp的access数据库管理程序        response.write 
"该空间不支持FSO组件,操作失败"
asp的access数据库管理程序    
else
asp的access数据库管理程序        fso.deletefolder(delpath)
asp的access数据库管理程序        
if Err <> 0 Then
asp的access数据库管理程序            response.write 
"清理失败或没找到文件"
asp的access数据库管理程序        
else
asp的access数据库管理程序            response.write 
"成功清理备份数据库"
asp的access数据库管理程序        
end if
asp的access数据库管理程序    
end if
asp的access数据库管理程序
end sub

相关文章: