老师帮忙看看我写的代码,每次执行都是重新下载,而不是直接打开本地文件。
Dim ftpsz As Date
Dim sz As Date
Dim ftp1 As New FTPClient
ftp1.Host=FtpIp
ftp1.Account = FtpUser
ftp1.Password = FtpPass
Dim bh As String = "\" & Tables("表A").current("xmid") & "\"
Dim localpath As String = projectpath & "RemoteFiles" & bh & FileSys.GetName(e.sender.Current("FileName"))
Dim ifo As new FileInfo(localpath)
ftpsz = ftp1.GetFileTime(e.sender.Current("FileName"))
sz=ifo.LastWriteTime
If FileSys.FileExists(localpath) AndAlso ftpsz=sz Then
'文件存在直接打开!","提示")
Dim Proc As New Process '定义一个新的Process
Proc.File = localpath
Proc.Start()
Else
ftp1.Download(e.sender.Current("FileName"), localpath , True)
Dim Proc As New Process '定义一个新的Process
Proc.File = localpath
Proc.Start()
End If
ftp1.Close()