HELP!!毕业射击(设计) 数据库的备份?
现是想作数据库的备份与还原
但是不知能否要在网页里面完成备份与还原?
------解决方案--------------------备份:
set MyFileObject=Server.CreateOBject( "Scripting.FileSystemObject ")
MyFileObject.CopyFile " "&Server.MapPath( "需要备份的文件路径,文件名 ")& " ", " "&Server.MapPath( "备份后的文件路径以及文件名 ")& " "
还原:
颠倒过来就可以了.
------解决方案-------------------- <%
'strOldDBPath是原数据的路径(包含数据库),strBackDBPath是备份数据库所在的路径(包含数据库)
Function BackAccess(strOldDBPath, strBackDBPath, strError)
On Error Resume Next
Dim objFso
Dim strOldPath, strNewPath
strOldPath = Server.Mappath(strOldDBPath)
strNewPath = Server.Mappath(strBackDBPath)
Set objFso = Server.CreateObject( "Scripting.FileSystemObject ")
IF objFso.FileExists() Then
objFso.CopyFile strOldPath, strNewPath, True
BackAccess = True
Else
BackAccess = False
End If
If Err.Number <> 0 Then
BackAccess = False
strError = Err.Description
End Function
'如下例子
If BackAccess( "/DB/MyDB.MDB ", "/BackDB/20070401.MDB ", strErr) Then
Response.Write "备份数据库成功 "
Else
Response.Write "备份数据库失败!失败原因: " & strErr
End If
%>