以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  导入一个Excel时提示“没有足够的内存继续执行程序”  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=151327)

--  作者:ufo20085
--  发布时间:2020/6/20 17:16:00
--  导入一个Excel时提示“没有足够的内存继续执行程序”

一个Excel数据,大约4万行,14兆左右。

导入到foxtable里,居然提示“没有足够的内存继续执行程序”,导入失败。

以下是导入的代码:

 

Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog =DialogResult.OK Then
    Dim t As Table = Tables("整体通关时间分析列表展示数据")
    \'t.ResumeRedraw()
    t.StopRedraw()
    Dim App As New MSExcel.Application
    try
        Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(dlg.FileName)
        Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
        Dim Rg As MSExcel.Range = Ws.UsedRange
        Dim arg = rg.value
        For n As Integer = 2 To rg.Rows.Count
            Dim r As DataRow = t.DataTable.AddNew()
           
            For i As Integer = 1 To rg.Columns.count
                Dim cname As String = arg(1,i)
                If cname > "" AndAlso t.Cols.Contains(cname) Then
                    If cname > "" AndAlso t.Cols.Contains(cname) Then
                        If t.Cols(cname).IsDate AndAlso arg(n,i) = "" Then
                            r(cname) = Nothing
                        Else
                            r(cname) = arg(n, i)
                        End If
                    End If
                   
                End If
            Next
        Next
    catch ex As exception
        msgbox(ex.message)
        MessageBox.Show("导入失败!","恭喜!")
    finally
        t.ResumeRedraw()
        app.quit
    End try
End If

 


--  作者:有点蓝
--  发布时间:2020/6/20 17:44:00
--  
重启项目再测试。 或者看看http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=100317&replyID=&skin=1