以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 索引和长度必须引用该字符串内的位置 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=144166) |
-- 作者:季朝龙 -- 发布时间:2019/12/12 15:18:00 -- 索引和长度必须引用该字符串内的位置 .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2019.12.8.1 错误所在事件:表,更新数据,DataColChanged 详细错误信息: 调用的目标发生了异常。 索引和长度必须引用该字符串内的位置。 参数名: length 代码如下: Dim cnt As Integer = Tables("更新数据").Rows.Count - 1 For i As Integer = 0 To cnt Dim n1 As String = Tables("更新数据").Rows(i).DataRow("料号1") Dim n2 As String = Tables("更新数据").Rows(i).DataRow("分群码") Dim dr0 As DataRow dr0 = DataTables("原始数据").Find("料号1 = \'" & n1 & "\' ","生产周期_天" ,0) Dim dr1 As DataRow dr1 = DataTables("原始数据").Find("料号1 = \'" & n1 & "\' ","生产周期_天" ,1) Dim dr2 As DataRow dr2 = DataTables("原始数据").Find("料号1 = \'" & n1 & "\' ","生产周期_天" ,2) If dr0 IsNot Nothing Then Tables("更新数据").Rows(i).DataRow("起始数量_台") = dr0.SQLGetValue("起始数量_台") Tables("更新数据").Rows(i).DataRow("截止数量_台") = dr0.SQLGetValue("截止数量_台") Tables("更新数据").Rows(i).DataRow("生产周期_天") = dr0.SQLGetValue("生产周期_天") End If Dim r As Row = Tables("更新数据").Rows(i) For j As Integer = 1 To 2 If j = 1 Then If dr1 IsNot Nothing Then r.Clone Tables("更新数据").Current("起始数量_台") = dr1.SQLGetValue("起始数量_台") Tables("更新数据").Current("截止数量_台") = dr1.SQLGetValue("截止数量_台") Tables("更新数据").Current("生产周期_天") = dr1.SQLGetValue("生产周期_天") End If Else If j = 2 Then If dr2 IsNot Nothing Then r.Clone Tables("更新数据").Current("起始数量_台") = dr2.SQLGetValue("起始数量_台") Tables("更新数据").Current("截止数量_台") = dr2.SQLGetValue("截止数量_台") Tables("更新数据").Current("生产周期_天") = dr2.SQLGetValue("生产周期_天") End If End If Next Next |
-- 作者:有点蓝 -- 发布时间:2019/12/12 15:31:00 -- 错误所在事件:表,更新数据,DataColChanged 检查这个表事件
|
-- 作者:季朝龙 -- 发布时间:2019/12/12 15:40:00 -- 我重置列的时候没有问题的,只有单机窗口按钮时才出现问题 If e.DataCol.Name = "料号" Then If e.DataRow("分群码说明").Substring(0,2) = "板卡" Dim n As Integer = e.DataRow("品名").IndexOf("组件") If n = -1 Then e.DataRow("分类") = "其他板卡组件" Else e.DataRow("分类") = e.DataRow("品名").Substring(n-2,2) End If Else If e.DataRow("分群码说明").Substring(0,2) = "成品" Then e.DataRow("分类") = "成品" Else If e.DataRow("分群码说明").Substring(0,2) = "裸机" Then e.DataRow("分类") = "裸机" Else If e.DataRow("分群码说明").Substring(0,2) = "辅料" Then e.DataRow("分类") = "辅料" Else If e.DataRow("分群码说明").Substring(0,2) = "组装" Then e.DataRow("分类") = "组装" Else e.DataRow("分类") = "其他" End If e.DataRow("料号1") = e.DataRow("料号").Substring(0,6) + e.DataRow("分类") End If |
-- 作者:有点蓝 -- 发布时间:2019/12/12 16:03:00 -- Select Case e.DataCol.Name Case "分群码说明","品名" If e.DataRow.isnull("分群码说明") = False AndAlso e.DataRow("分群码说明").length >= 2 If e.DataRow("分群码说明").Substring(0,2) = "板卡" Dim n As Integer = e.DataRow("品名").IndexOf("组件") If n = -1 Then e.DataRow("分类") = "其他板卡组件" ElseIf e.DataRow("分类") = e.DataRow("品名").Substring(n-2,2) End If Else If e.DataRow("分群码说明").Substring(0,2) = "成品" Then e.DataRow("分类") = "成品" Else If e.DataRow("分群码说明").Substring(0,2) = "裸机" Then e.DataRow("分类") = "裸机" Else If e.DataRow("分群码说明").Substring(0,2) = "辅料" Then e.DataRow("分类") = "辅料" Else If e.DataRow("分群码说明").Substring(0,2) = "组装" Then e.DataRow("分类") = "组装" Else e.DataRow("分类") = "其他" End If End If Case "料号","分类" If e.DataRow.isnull("料号") = False AndAlso e.DataRow("分群码说明").length >= 6 e.DataRow("料号1") = e.DataRow("料号").Substring(0,6) + e.DataRow("分类") Else e.DataRow("料号1") = e.DataRow("分类") End If End Select
|