[VBA ] 想請問一下runtime error

看板Visual_Basic作者 (修明)時間18年前 (2007/03/21 12:59), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
現在的問題是處理一個FTP上傳檔案的問題 由於資料有4G這麼大 當我在資料上傳到一半的時候發生runtime error'63':資料錄個數不正確 請問一下這是一個什麼樣的問題? 下面有source code 發生錯誤的程式碼在 Get #ff, , sBuffer Public Function PutFile(ByVal LocalFile As String, ByVal Destination As String) As Boolean PutFile = False If Not (bActiveSession) Then Exit Function If Not (FileReal(LocalFile)) Then Exit Function Dim sBuffer As String * 1024 Dim FileData As String Dim SentBytes As Double Dim nRet As Long Dim spRate As Integer Dim nTotFileLen As Long Dim nFileLen As Long Dim hFile As Long Dim t As Long Dim ff As Integer ff = FreeFile DelFile = Destination Open LocalFile For Binary As #ff If (ff = 0) Then Exit Function nTotFileLen = LOF(ff) SentBytes = 0 nFileLen = 0 spRate = 0 hFile = FtpOpenFile(hConn, Destination, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0) If hFile = 0 Then Exit Function End If Do Get #ff, , sBuffer Label1.Caption = "檔案上傳中" Label1.Refresh If nFileLen < nTotFileLen - sReadBuffer Then If InternetWriteFile(hFile, sBuffer, sReadBuffer, nRet) = 0 Then Call RemoveFile(DelFile) Exit Function End If SentBytes = SentBytes + sReadBuffer nFileLen = nFileLen + sReadBuffer Else If InternetWriteFile(hFile, sBuffer, nTotFileLen - nFileLen, nRet) = 0 Then Call RemoveFile(DelFile) Exit Function End If SentBytes = SentBytes + (nTotFileLen - nFileLen) nFileLen = nTotFileLen End If Loop Until nFileLen >= nTotFileLen Close InternetCloseHandle hFile PutFile = True Label1.Caption = "檔案上傳完畢" Label1.Refresh Call ListRemoteFile(RemoteDir) End Function -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.155.49
文章代碼(AID): #160Bl1Sh (Visual_Basic)
文章代碼(AID): #160Bl1Sh (Visual_Basic)