以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  提示错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=121093)

--  作者:kaituozhe
--  发布时间:2018/6/29 8:35:00
--  提示错误

提示如下错误是什么原因?

.NET Framework 版本:2.0.50727.8830
Foxtable 版本:2018.3.9.1
错误所在事件:表,销售明细,DataColChanged
详细错误信息:
调用的目标发生了异常。
引发类型为“System.OutOfMemoryException”的异常。


--  作者:有点甜
--  发布时间:2018/6/29 8:39:00
--  

内存溢出。你datacolchanged事件写了什么耗资源的代码?贴出来看看。


--  作者:kaituozhe
--  发布时间:2018/6/29 9:16:00
--  
那可能,我重置行了,20多万行
--  作者:kaituozhe
--  发布时间:2018/6/29 9:19:00
--  

不想加载表,使用黄色代码来提取数据,速度好慢呀,如果加载进来数据量又非常大,该怎么办?

Dim filter As String = "BillId = \'"& e.DataRow("销售内码") & "\'"
\'Dim filter2 As String = "BillId = \'"& e.DataRow("销售内码") & "\'and ord = \'"& e.DataRow("单据行号") & "\' "
\'Dim filter3 As String = "UserCode = \'"& e.DataRow("单位编号") & "\'"
\'Dim filter4 As String = "BaseRec = \'"& e.DataRow("商品编号") & "\'"
\'Dim filter5 As String = "UserCode = \'"& e.DataRow("供应商编号") & "\'"
\'Dim filter6 As String = "PRec = \'"& e.DataRow("商品编号") & "\'"
Dim cmd1 As New SQL Command
Dim dt1 As DataTable
cmd1.Conn ecti
cmd1.Com mandText = "SEL ECT DISTINCT * From {BillIndex}"
dt1 = cmd1.ExecuteR eader()

Select Case e.DataCol.name
    Case "销售内码"
        Dim dr As DataRow =  dt1.find(filter)      \'DataTables("BillIndex").find(filter)
        If dr IsNot Nothing Then
            e.DataRow("单据编号") = dr("BillCode")
            e.DataRow("日期") = dr("BillDate")
            e.DataRow("单位编号") = CStr(Format(dr("BRec"),"00000") )
            e.DataRow("单据摘要") = dr("Comment")
        End If
        \'Dim dr2 As DataRow = DataTables("SaleBill").find(filter2)
        \'If dr2 IsNot Nothing Then
            \'\'e.DataRow("单据行号") = dr2("ord")
            \'e.DataRow("商品编号") = dr2("PRec")
            \'e.DataRow("生产日期") = dr2("OutFactoryDate")
            \'e.DataRow("有效日期") = dr2("ValidityPeriod")
            \'e.DataRow("销售数量") = dr2("Qty")
            \'e.DataRow("销售单价") = dr2("SalePrice")
            \'e.DataRow("销售金额") = dr2("TaxTotal")
            \'e.DataRow("供应商编号") = CStr(Format(dr2("ProviderId"),"00000") )
        \'End If
        \'\'e.DataRow("销售明细金额") = DataTables("SaleBill").Compute("sum(TaxTotal)",filter)
    \'Case "单位编号"
        \'Dim dr3 As DataRow = DataTables("btype").find(filter3)
        \'If dr3 IsNot Nothing Then
            \'e.DataRow("单位名称") = dr3("FullName")
        \'End If
    \'Case "商品编号"
        \'Dim dr4 As DataRow = DataTables("BaseNameChange").find(filter4)
        \'If dr4 IsNot Nothing Then
            \'e.DataRow("商品名称") = dr4("Name")
        \'End If
        \'Dim dr6 As DataRow = DataTables("BuyBill").find(filter6)
        \'If dr6 IsNot Nothing Then
            \'e.DataRow("成本单价") = dr6("SalePrice")
        \'End If
    \'Case "供应商编号"
        \'Dim dr5 As DataRow = DataTables("btype").find(filter5)
        \'If dr5 IsNot Nothing Then
            \'e.DataRow("供应商名称") = dr5("FullName")
        \'End If
    \'Case "销售金额","成本金额"
        \'e.DataRow("利润") = e.DataRow("销售金额") - e.DataRow("成本金额")
    \'Case "成本单价","销售数量"
        \'e.DataRow("成本金额") = e.DataRow("销售数量") * e.DataRow("成本单价")
    \'Case "利润"
        \'If e.DataRow("销售金额") <> 0 Then
            \'e.DataRow("利润率") = e.DataRow("利润")/e.DataRow("销售金额")
        \'End If
End Select


--  作者:kaituozhe
--  发布时间:2018/6/29 9:24:00
--  
仅黄色部分一个表十行数据就使用了2分钟的时间,有没有快点方法。
--  作者:有点甜
--  发布时间:2018/6/29 10:15:00
--  

1、你每次触发datacolchanged事件都把表数据弄进来?这样更不符合逻辑。

 

你可以在afterOpenProject事件加入一个临时表,把表数据弄进来,或者弄进来一个空表。

 

需要的时候,再find或者sqlfind。

 

2、你重置列,你有多少行,就执行了多少次datacolchanged事件,速度肯定慢啊。


--  作者:kaituozhe
--  发布时间:2018/6/29 10:46:00
--  

明白了