asp的access数据库管理程序

简介:

asp的access数据库管理程序

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


本文转自博客园cloudgamer的博客,原文链接:asp的access数据库管理程序,如需转载请自行联系原博主。


相关文章
|
1月前
|
SQL 存储 数据可视化
access sql 数据库,Access SQL
access sql 数据库,Access SQL
|
1月前
|
前端开发 Java 数据库
基于Springboot的漫画网站22(程序+数据库+论文)可帮忙远程调试
基于Springboot的漫画网站22(程序+数据库+论文)可帮忙远程调试
|
1月前
|
JavaScript Java 关系型数据库
基于vue的MOBA类游戏攻略分享平台23(程序+数据库+论文)可帮忙远程调试
基于vue的MOBA类游戏攻略分享平台23(程序+数据库+论文)可帮忙远程调试
|
1月前
|
Java 关系型数据库 MySQL
基于springboot+vue网吧管理系统(程序+数据库+文档)
基于springboot+vue网吧管理系统(程序+数据库+文档)
|
1月前
|
搜索推荐 Java 数据库
基于springboot+vue网上图书商城(程序+数据库+文档)
基于springboot+vue网上图书商城(程序+数据库+文档)
|
1月前
|
Java 关系型数据库 数据库
基于SpringBoot大药房管理系统(程序+数据库+文档)
基于SpringBoot大药房管理系统(程序+数据库+文档)
|
1月前
|
JavaScript Java 数据库
基于springboot的地方美食分享网站(程序+数据库+文档)
基于springboot的地方美食分享网站(程序+数据库+文档)
|
1月前
|
JavaScript 前端开发 Java
基于SpringBoot的人事管理系统(程序+数据库+文档)
基于SpringBoot的人事管理系统(程序+数据库+文档)
|
1月前
|
存储 安全 Java
基于springboot的美食分享平台(程序+数据库+文档)
基于springboot的美食分享平台(程序+数据库+文档)
|
1月前
|
小程序 Java 关系型数据库
基于springboot的场地预约小程序的设计与实现(程序+数据库+文档)
基于springboot的场地预约小程序的设计与实现(程序+数据库+文档)

热门文章

最新文章