If e.DataCol.name = "一级分类" Then
Dim bh As DataRow = DataTables("取值代码表").find("商品信息表_一级分类 = '" & e.NewValue & "'")
If bh IsNot Nothing Then
e.DataRow("编号前缀") = bh("商品信息表_编号前缀")
End If
If e.DataRow.isnull("一级分类") Then
e.DataRow("商品编号") = Nothing
Else
Dim lb As String = e.DataRow("编号前缀")
If e.DataRow("商品编号").StartsWith(lb) = False '如果编号前缀不符
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(商品编号)","一级分类 = '" & e.DataRow("一级分类") & "' And [_Identify] <> " & e.DataRow("_Identify") ) '取得该类别的最大编号
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(1,3)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("商品编号") = lb & Format(idx,"000")
End If
End If
End If
以上代码报错,报错为
.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2016.3.13.1
错误所在事件:表,商品信息表,DataColChanged
详细错误信息:
调用的目标发生了异常。
无法在 System.Int32 和 System.String 上执行“=”操作。