如何用asp做access数据库备份

如何用asp做access数据库备份,第1张

用asp做access数据备份

<% SQL="backup database 数据库名 to disk='"&

Server.MapPath("backup")&"\"&"backuptext.dat"&"'"

set cnn=Server.createobject("adodb.connection")

cnn.open "driver={SQL Server}Server=服务器名uid=sapwd="

cnn.execute SQL

on error resume next

if err<>0 then

response.write "错误:"&err.Descripting

else

response.write "数据备份成功!"

end if %>

<% dim action dim admin_flag Function finddir(filepath) finddir="" for i=1 to len(filepath) if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then abc=i exit for end if next if abc <>1 then finddir=left(filepath,len(filepath)-abc+1) end if end Function action=trim(request("action")) dim dbpath,bkfolder,bkdbname,fso,fso1 Dim uploadpath '备份数据 select case action case "BackupData" '备份数据 if request("act")="Backup" then call updata() else call BackupData() end if case "RestoreData" '恢复数据 dim backpath if request("act")="Restore" then Dbpath=request.form("Dbpath") backpath=request.form("backpath") if dbpath="" then response.write "请输入您要恢复成的数据库全名" else Dbpath=server.mappath(Dbpath) end if backpath=server.mappath(backpath) Set Fso=server.createobject("scripting.filesystemobject") if fso.fileexists(dbpath) then fso.copyfile Dbpath,Backpath response.write "<br>" response.write "<br>" response.write "<br>" response.write "<center>成功恢复数据!" response.write "</center>" else response.write "备份目录下并无您的备份文件!" end if else call RestoreData() end if end select '====================备份数据库========================= sub BackupData() If IsSqlDataBase = 1 Then SQLUserReadme() Exit Sub End If %>


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/56746.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-02-26
下一篇2023-02-26

发表评论

登录后才能评论

评论列表(0条)

    保存