以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  出现错误:引发类型为“System.OutOfMemoryException”的异常。  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=48535)

--  作者:yankunhao
--  发布时间:2014/3/31 14:01:00
--  出现错误:引发类型为“System.OutOfMemoryException”的异常。

 

请问下面这样的错误是什么意思?

 

.NET Framework 版本:2.0.50727.3053
Foxtable 版本:2014.3.8.1
错误所在事件:窗口,产品规格表,ComboBox5,ValueChanged
详细错误信息:
引发类型为“System.OutOfMemoryException”的异常。


--  作者:Bin
--  发布时间:2014/3/31 14:02:00
--  
内存溢出了,  窗口,产品规格表,ComboBox5,ValueChanged  的代码发出来看看.
--  作者:yankunhao
--  发布时间:2014/3/31 14:20:00
--  

Dim s As String
s=e.Sender.Value
\'s=Forms("产品规格表").Controls("ComboBox5").text

\'try
    Dim ids As String
    Dim drs As List(Of DataRow)
    drs = DataTables("料品资料查询表").Select("type_name = \'" & s &"\'")      \' 发现如果用这样的代码就没上面的提示!
    \'drs = DataTables("料品资料查询表").SQLSelect("type_name = \'" & s & "\'") ’ 如果用这样的代码就有个别的的会出现上面的提示!
    
    For Each dr As DataRow In drs
        ids = ids & ",\'" & dr("part_no") & "\'"
    Next
    ids = ids.Trim(",")
   \'MessageBox.Show(ids,"提示",MessageBoxButtons.OK)
    If ids <> "" Then
    DataTables("obas_part_spec").LoadFilter = "part_no In (" & ids & ")"
    \'SystemReady = False
    DataTables("obas_part_spec").Load()
    \'SystemReady = True
    End If
\'Catch ex As Exception
    \'MessageBox.Show("没找到相关数据!","提示",MessageBoxButtons.OK)
\'End Try

Select Case s
    Case "铝门锁","鹅旦锁","有尾门锁"
       
        \'If Forms("产品规格表2").Opened = False Then
            SystemReady = False
            Forms("产品规格表2").Show
            SystemReady = True
           
            If Forms("产品规格表2").Opened Then
                \'SystemReady = False
                Forms("产品规格表").Close
                \' SystemReady = True
            End If
           
       \' End If
        \'Case Else
        \' Return
    Case Else
        
        \'try
          Dim t As WinForm.Table = e.Form.Controls("Table1")

            If Tables("obas_part_spec").Current IsNot Nothing Then
            Dim s1 As String = Tables("obas_part_spec").Current("part_no")
                       
            \'If e.Form.Controls("TextBox1").Text <> "" Then
                t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号,obas_part1.bom_draw_no_wf as 备注,wf_zh as 珠号  from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part=\'" & s1 & "\'ORDER BY 排序","erp",True)
                t.Table.SetColVisibleWidth("物料编码|70|名称|70|规格|150|数量|19|图号|99|珠号|25|备注|30")
            Else
             Dim s2 As String ="0"
                t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号,obas_part1.bom_draw_no_wf as 备注,wf_zh as 珠号  from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part=\'" & s2 & "\'ORDER BY 排序","erp",True)
                t.Table.SetColVisibleWidth("物料编码|70|名称|70|规格|150|数量|19|图号|99|珠号|25|备注|30")
            End If
        \'Catch ex As Exception
           \' Dim s2 As String ="0"
           \' Dim t As WinForm.Table = e.Form.Controls("Table1")
           
            \'t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号,obas_part1.bom_draw_no_wf as 备注,wf_zh as 珠号  from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part=\'" & s2 & "\'ORDER BY 排序","erp",True)
            \'t.Table.SetColVisibleWidth("物料编码|70|名称|70|规格|150|数量|19|图号|99|珠号|25|备注|30")
           
            \'MessageBox.Show("没找到相关数据!","提示",MessageBoxButtons.OK)
        \'End Try
       
        If Forms("产品规格表").Opened=True Then
            Dim f As WinForm.Form = Forms("产品规格表")
            If Tables("obas_part_spec").Current IsNot Nothing Then
                Dim zt As String
                If Tables("obas_part_spec").Current("sheet_sta")="0" Then
                    zt="未审核"
                ElseIf Tables("obas_part_spec").Current("sheet_sta")="1" Then
                    zt="已审核"
                End If
                f.Text="产品规格表 (" & zt & ")"
                If Tables("obas_part_spec").Current IsNot Nothing Then
                    Dim b As Boolean = Tables("obas_part_spec").Current("act_sw")
                    Select Case b
                        Case True
                            e.Form.BackColor = Color.WhiteSmoke
                        Case Else
                            e.Form.BackColor = Color.LemonChiffon
                    End Select
                End If
               
            Else
               
                f.Text="产品规格表"
            End If
        End If
       
End Select


--  作者:Bin
--  发布时间:2014/3/31 14:22:00
--  
drs = DataTables("料品资料查询表").Select("type_name = \'" & s &"\'")      \' 在当前表查找
    \'drs = DataTables("料品资料查询表").SQLSelect("type_name = \'" & s & "\'")   \'到后台查找,YOU可能是因为你的后台数据太庞大了,装不下导致的.
--  作者:yankunhao
--  发布时间:2014/3/31 14:23:00
--  

现在发现,如果选择值为 "铝门锁","鹅旦锁","有尾门锁" 时会提示下面的错误,请问是什么意思?

.NET Framework 版本:2.0.50727.3053
Foxtable 版本:2014.3.8.1
错误所在事件:窗口,产品规格表,ComboBox5,ValueChanged
详细错误信息:
集合已修改;可能无法执行枚举操作。


--  作者:Bin
--  发布时间:2014/3/31 14:24:00
--  
运行到哪一步出错呢? 
建议您用这个方法:
http://www.foxtable.com/help/topics/1485.htm

先找出是哪一行出错,然后分析原因,搞不定,可以在论坛发帖,贴出代码,并告诉我们运行到哪一行出错,以及错误提示。

或者上例子.



--  作者:yankunhao
--  发布时间:2014/3/31 14:41:00
--  

现在发现将下面的代码 

 

 \'SystemReady = False
    DataTables("obas_part_spec").Load()
    \'SystemReady = True


 改为这样的代码,就正常了,但不明白原因,请指正!

 

 SystemReady = False
    DataTables("obas_part_spec").Load()
    SystemReady = True


--  作者:Bin
--  发布时间:2014/3/31 14:44:00
--  
想不通,我做了个例子测试并没有这样的问题. 你上个例子看看.
--  作者:yankunhao
--  发布时间:2014/3/31 14:46:00
--  
以下是引用Bin在2014-3-31 14:44:00的发言:
想不通,我做了个例子测试并没有这样的问题. 你上个例子看看.

我这个比较复杂,数据也多,一时间没法提供例子。


--  作者:Bin
--  发布时间:2014/3/31 14:48:00
--  
做个简单例子,可以重现错误的即可.   数据随便输入一些测试数据.