一项目退出时出错,提示如下,附上项目BeforeCloseProject事件代码,如何解决,请各位老师指教,谢谢!!
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2019.12.17.18
错误所在事件:项目,BeforeCloseProject
详细错误信息:
对路径的访问被拒绝。
项目BeforeCloseProject事件代码:(出错语句用颜色标记)
'自动备份项目并删除3天前的备份文件
Dim t As String = format(Date.Now(),"yyyyMMdd")
Dim a As String = ProjectPath & "项目备份文件"
'保存项目
Syscmd.Project.Save()
'删除文件夹
For Each dir As String In FileSys.GetDirectories(a)
If Right(dir,8) <= t Then
FileSys.DeleteDirectory(dir,2,2)
End If
Next
'删除过期文件
For Each f As String In filesys.GetFiles(a)
Dim Info As New FileInfo(f)
If Info.CreationTime.AddDays(2) < Date.Today Then
filesys.DeleteFile(f)
End If
Next
'复制备份文件
FileSys.CopyFile(ProjectPath & "资料收集器.foxdb", a & "\资料收集器" & t & "\资料收集器.foxdb",True)
FileSys.CopyFile("C:\foxtable\Development\Code.mdb", a & "\资料收集器" & t & "\Code.mdb",True)
'压缩备份文件
Dim zip As New zipFile
zip.Create(a & "\资料收集器" & t & ".zip")
zip.AddFolder(a & "\资料收集器" & t )
zip.Close()
[此贴子已经被作者于2019/12/14 20:06:39编辑过]