以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 随机性调用的目标发生了异常。 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188851) |
||||
-- 作者:1234567 -- 发布时间:2023/10/24 15:44:00 -- 随机性调用的目标发生了异常。 .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2022.8.18.1 错误所在事件:表,零件加工报价系统_Table4,DataColChanged 详细错误信息: 调用的目标发生了异常。 “name”参数不能为空。 参数名: name 老师,DataColChanged事件,随机性出现报警 If e.DataCol.Name = "高度" OrElse e.DataCol.Name = "长度" Then \'如果内容发生变动的是品名列 If e.DataRow.IsNull("高度") OrElse e.DataRow.IsNull("长度") Then \'如果新值是空白,也就是品名列的内容为空 e.DataRow("CNC长度工时") = Nothing \'那么清空此行单价列的内容 Else Dim dr As DataRow \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr Dim cc As Double = e.DataRow("长度") Dim cn As String If cc <= 20 Then cn = "AA" Else If cc > 20 AndAlso cc <= 40 cn = "BB" Else If cc > 40 AndAlso cc <= 60 cn = "CC" Else If cc > 60 AndAlso cc <= 80 cn = "DD" Else If cc > 80 AndAlso cc <= 100 cn = "EE" Else If cc > 100 AndAlso cc <= 125 cn = "FF" Else If cc > 125 AndAlso cc <= 150 cn = "GG" Else If cc > 150 AndAlso cc <= 200 cn = "HH" Else If cc > 200 AndAlso cc <= 250 cn = "II" Else If cc > 250 AndAlso cc <= 300 cn = "JJ" Else If cc > 300 AndAlso cc <= 400 cn = "KK" Else If cc > 400 AndAlso cc <= 600 cn = "LL" Else If cc > 600 AndAlso cc <= 800 cn = "MM" End If Dim cs As Double = e.DataRow("高度") Dim css As String If cs <= 5 Then css = "≤5" Else If cs > 5 AndAlso cs <= 10 css = "≤10" Else If cs > 10 AndAlso cs <= 15 css = "≤15" Else If cs > 15 AndAlso cs <= 20 css = "≤20" Else If cs > 20 AndAlso cs <= 25 css = "≤25" Else If cs > 25 AndAlso cs <= 30 css = "≤30" Else If cs > 30 AndAlso cs <= 35 css = "≤35" Else If cs > 35 AndAlso cs <= 40 css = "≤40" Else If cs > 40 AndAlso cs <= 45 css = "≤45" Else If cs > 45 AndAlso cs <= 50 css = "≤50" Else If cs > 50 AndAlso cs <= 55 css = "≤55" Else If cs > 55 AndAlso cs <= 60 css = "≤60" End If dr = DataTables("查询表").Find("[深度] = \'" & css & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing e.DataRow("CNC长度工时") = dr(cn) End If End If End If If e.DataCol.Name = "高度" OrElse e.DataCol.Name = "宽度" Then \'如果内容发生变动的是品名列 If e.DataRow.IsNull("高度") OrElse e.DataRow.IsNull("宽度") Then \'如果新值是空白,也就是品名列的内容为空 e.DataRow("CNC宽度工时") = Nothing \'那么清空此行单价列的内容 Else Dim dr As DataRow \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr Dim cc As Double = e.DataRow("宽度") Dim cn As String If cc <= 20 Then cn = "AA" Else If cc > 20 AndAlso cc <= 40 cn = "BB" Else If cc > 40 AndAlso cc <= 60 cn = "CC" Else If cc > 60 AndAlso cc <= 80 cn = "DD" Else If cc > 80 AndAlso cc <= 100 cn = "EE" Else If cc > 100 AndAlso cc <= 125 cn = "FF" Else If cc > 125 AndAlso cc <= 150 cn = "GG" Else If cc > 150 AndAlso cc <= 200 cn = "HH" Else If cc > 200 AndAlso cc <= 250 cn = "II" Else If cc > 250 AndAlso cc <= 300 cn = "JJ" Else If cc > 300 AndAlso cc <= 400 cn = "KK" Else If cc > 400 AndAlso cc <= 600 cn = "LL" Else If cc > 600 AndAlso cc <= 800 cn = "MM" End If Dim cs As Double = e.DataRow("高度") Dim css As String If cs <= 5 Then css = "≤5" Else If cs > 5 AndAlso cs <= 10 css = "≤10" Else If cs > 10 AndAlso cs <= 15 css = "≤15" Else If cs > 15 AndAlso cs <= 20 css = "≤20" Else If cs > 20 AndAlso cs <= 25 css = "≤25" Else If cs > 25 AndAlso cs <= 30 css = "≤30" Else If cs > 30 AndAlso cs <= 35 css = "≤35" Else If cs > 35 AndAlso cs <= 40 css = "≤40" Else If cs > 40 AndAlso cs <= 45 css = "≤45" Else If cs > 45 AndAlso cs <= 50 css = "≤50" Else If cs > 50 AndAlso cs <= 55 css = "≤55" Else If cs > 55 AndAlso cs <= 60 css = "≤60" End If dr = DataTables("查询表").Find("[深度] = \'" & css & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing e.DataRow("CNC宽度工时") = dr(cn) End If End If End If |
||||
-- 作者:有点蓝 -- 发布时间:2023/10/24 16:06:00 -- 应该是长度/宽度的值小于等于20,或者大于800,导致cn变量为空值 |
||||
-- 作者:1234567 -- 发布时间:2023/10/24 16:34:00 -- 我尝试着输入不同的数据,有时候正常,有时候出问题 |
||||
-- 作者:有点蓝 -- 发布时间:2023/10/24 16:39:00 -- 看看自己的判断代码咯,只有小于800之间值cn才有值,大于800,cn就是空值 |
||||
-- 作者:1234567 -- 发布时间:2023/10/24 16:42:00 -- 我就是奇怪,为什么有时候输入超过800的值,又没有异常报警? |
||||
-- 作者:有点蓝 -- 发布时间:2023/10/24 17:08:00 -- 加代码调试咯。看看都是什么值 msgbox(cn) msgbox(css)
|
||||
-- 作者:1234567 -- 发布时间:2023/10/25 8:43:00 -- 测试问题一样 |
||||
-- 作者:有点蓝 -- 发布时间:2023/10/25 9:00:00 -- 出错的时候调试都是些什么值? |
||||
-- 作者:1234567 -- 发布时间:2023/10/25 9:05:00 -- |
||||
-- 作者:1234567 -- 发布时间:2023/10/25 9:05:00 --
|