急!ASP数据库备份遇到问题,谁能帮帮我啊?有全代码
运行会出错误<%
if session("postboard_admin")<>true then
response.write("<script>alert(""你没有权限进行此操作!"")</script>")
response.end()
end if
IF request.form("behave")<>"backup" THEN '查看动作
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<style type="text/css">
A:link,A:active,A:visited{TEXT-DECORATION:none ;Color:#3C2F1D}
A:hover{TEXT-DECORATION: underline;Color:#4455aa}
body
{
FONT-SIZE: 12px;
COLOR: #000000;
FONT-FAMILY: 宋体;
background-color: #ECF5FF;
background-image: url(../img/leaf.gif);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
font{line-height : normal ;}
td { table-layout:fixed;
word-break :break-all;
font-family:"宋体";
font-size: 12px;
line-height: 15px;
}
th
{
background-color: #877C59;
COLOR: #F4F2EC;
font-size: 12px;
font-weight:bold;
}
</style>
<title>网站管理-->论坛管理-->留言备份</title></head>
<body>
<table width="598" height="100" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E8F2FF">
<tr>
<td height="25" colspan="2" background="img/bg2.gif"> 留言备份</td>
</tr>
<tr>
<td bgcolor=white>
<form name=backupmessages method=post action=backup.asp>
<p> <font color=blue>原数据库</font>的存放位置和文件名:</p>
<p> <input type=text name=mdbfile value="msgdata/msg.mdb" size=50></p>
<p> <font color=blue>备份</font>到:</p>
<p> <input type=text name=bkname value="msgdata/backup_<%=date()%>.mdb.bk" size=50></p>
<p> 如上填写的目录不存在,则 <input type=radio value=create name=Willcreate checked> 创建 | <input type=radio value=inform name=Willcreate> 不创建,请通知我</p>
<p> <input type=submit value="下一步-->">
<input type=hidden name=behave value="backup"></p>
</form>
</td>
</tr>
</table>
</body>
</html>
<%
ELSE
If request.form("bkname")<>empty and request.form("Willcreate")<>empty and request.form("mdbfile")<>empty Then '检查是否全填
Bfile=server.mappath(request.form("bkname"))'确定备份文件的物理文件名
Bfolder=mid(request.form("bkname"),1,instr(request.form("bkname"),"/")-1)'确定备份文件的路径
Bfolder=server.mappath(Bfolder)'确定备份文件的物理路径
originalfile=server.mappath(request.form("mdbfile"))'确定原数据库物理文件名
Set fs = CreateObject("Scripting.FileSystemObject")
'BFE=fs.FileExists(Bfile)
BFdE=fs.FolderExists(Bfolder)'查看备份目录是否存在
OFE=fs.FileExists(originalfile)'查看原数据库是否存在
if OFE<>true then '如果原数据库不存在
response.write("<script>alert(""原数据库文件不存在"");history.back(1)</script>")
response.end()
end if
if BFdE<>true then '如果要备份的目录不存在
if request.form("Willcreate")="inform" then '如果是否创建单选框值为通知,即不创建,则
response.write("<a href=javascript:history.back(1)>要存放备份的目录不存在</a>")
response.write("<script>alert(""要存放备份的目录不存在"");history.back(1)</script>")
response.end()
elseif request.form("Willcreate")="create" then '如果为创建
fs.CreateFolder(Bfolder) '则创建
end if
end if
fs.CopyFile originalfile,Bfolder&"\"&Bfile&".bk"
response.write("<script>alert(""已成功备份"");navigate(""backup.asp"")</script>")
set fs=nothing
Else
response.write("<script>alert(""三项都不能为空"");navigate(""backup.asp"")</script>")
End If
END IF
%>