;>否</A>
<%end if%></td>
</tr>
<%rs.MoveNext
loop
end if
rs.Close
set rs=nothing
%>
</table>
<%end sub%>
3.3.6 数据库管理与备份
a.界面
b.功能说明:数据库备份/数据库压缩/数据库恢复。
c.部分代码如下(生成函数,后台代码基本模块化了)
<%sub backupdata()
Dbpath=request.form("Dbpath")
Dbpath=server.mappath(Dbpath)
bkfolder=request.form("bkfolder")
bkdbname=request.form("bkdbname")
Set Fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(dbpath) then
If CheckDir(bkfolder) = True Then
fso.copyfile dbpath,bkfolder& "\"& bkdbname
else
MakeNewsDir bkfolder
fso.copyfile dbpath,bkfolder& "\"& bkdbname
end if
response.write "<SCRIPT LANGUAGE=java script>alert (' 成功备份数据!');window.location.href='admin_backupdata.asp';</script>"
response.end
Else
response.write "<SCRIPT LANGUAGE=java script>alert (' 备份数据库失败,您要备份的数据库不存在!');window.location.href='admin_backupdata.asp';</script>"
response.end
End if
end sub
'------------------检查某一目录是否存在-------------------
Function CheckDir(FolderPath)
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso1 = CreateObject("Scripting.FileSystemObject")
If fso1.FolderExists(FolderPath) then
'存在
CheckDir = True
Else
'不存在
CheckDir = False
End if
Set fso1 = nothing
End Function
'-------------根据指定名称生成目录---------
Function MakeNewsDir(foldername)
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set f = fso1.CreateFolder(foldername)
MakeNewsDir = True
Set fso1 = nothing
End Function %>