看板 Visual_Basic 關於我們 聯絡資訊
請輸入專案類型(網站專案或者應用程式專案): Dim reader As System.I.Directoryo.StreamReader Dim line As String = Nothing Dim value As String() Dim db = New DataTable() Dim dv = new DataView() With System.Io.Directory.GetFileSystemEntries("D:\省略") ShowLog("TotalFile:",.Length) For j =0 To .Length-1 ShowLog("Files:",j+1,"/",.Length) Dim fname As String=.GetValue(j) reader = New System.IO.StreamReader(fname) Do while reader.peek()<> -1 line =reader.Readline() line =line.TriEnd() value =line.spilt(",")'跑到一半會跳出System.outofMemory錯誤 if value.Length >4 And line.Contains("Time") dt.Rows.Add(value(0),value(1),value(2),value(3)) End if Loop End with (一)因為同之程式我有跑另外一個資料夾檔案過,改的地方只有取的一些規則而已 可以順利跑完,雖然檔案數跟裡面內容有差異。 (二)有甚麼寫法能解決方法嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.22.148.139 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1566644169.A.9FA.html
evil2004: 是不是有參考什麼32位元的dll檔? 08/26 12:48
evil2004: 然後CSV檔很大嗎? 08/26 12:49
evil2004: 另外如果是檔案數量多的話 reader沒close可能也是問題 08/26 13:01
feobzq: 可以先加個counter配合try catch檢查是哪一行出錯看看 08/26 13:32
johnpage: 檔案大於2G,請改64位元處理 09/17 17:12