www.gusucode.com > 深度梦想整站系统(asp) 1.14.02源码程序 > admin/dataManage/data_Backup.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
projectRootPath = "../../"	'相对当前应用程序根的位置
%>
<!-- #include file="../web.config.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>数据管理</title>

    <link href="../themes/<%=theme_Path%>/main.css" rel="stylesheet" type="text/css" />
</head>

</head>
<body  id="bodyBg1">
<br />
&nbsp; <a href="data_Backup.asp">备份数据库</a>
<hr class="Nav-hr" />
<br />
<dl class="manageContent">
    <dt>备份数据库</dt>
    <dd>
    	<br />
    	   <%
	if request.Form("action")="Backup" then
	call backupdata()
	else
%>
      &nbsp;&nbsp;&nbsp;<B>备份数据</B>( 需要FSO支持,FSO相关帮助请看微软网站 ) 
      <form action="" method="post" id="form1">
        <br />&nbsp;&nbsp; 当前数据库路径(相对路径): <b><%=DBpath%></b>  <br />
        &nbsp;&nbsp; 备份数据库目录(相对路径):  <b>Databackup</b>
        &nbsp;如目录不存在,程序将自动创建<br />
        &nbsp;&nbsp; 备份数据库名称(填写名称): 
        <input type="text" size="20" name="bkDBname" value="data_backup.mdb" />
        &nbsp;如备份目录有该文件,将覆盖,如没有,将自动创建<br />
        &nbsp; &nbsp;   <input type="submit" value="确定备份" />
		<input type="hidden" name="action" value="Backup" />
        <hr /> 
        &nbsp;&nbsp;在上面填写本程序的数据库路径全名<br />
        &nbsp;&nbsp;您可以用这个功能来备份您的法规数据,以保证您的数据安全!<br />
        &nbsp;&nbsp;注意:所有路径都是相对与程序空间根目录的相对路径 
      </form>
<%end if%>
<%

sub backupdata()
		Dbfile=server.mappath(DBpath)
		
		bkfolder="Databackup"
		bkdbname=request.form("bkdbname")
		Set Fso=server.createobject("scripting.filesystemobject")
		if fso.fileexists(Dbfile) then
			If CheckDir(bkfolder) = True Then
			fso.copyfile Dbfile,bkfolder& "\"& bkdbname
			else
			MakeNewsDir bkfolder
			fso.copyfile Dbfile,bkfolder& "\"& bkdbname
			end if
			response.write "备份数据库成功,您备份的数据库路径为" &bkfolder& "\"& bkdbname
			response.write "<br /><br /><input type='button' value=' 返 回 ' onclick='javascript:history.go(-1)'>"
		Else
			errmsg = "<li>找不到您所需要备份的文件。"
			response.write errmsg
		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
%>
        <br />
    </dd>
</dl>
<br />
</body>
</html>
<%
Call CloseConnDB()
%>