If e.DataRow.IsNull("入库日期") Then
e.DataRow("入库编号") = Nothing
Else
Dim bh1 As String = "RT" & Format(e.DataRow("入库日期"),"yyyyMMdd") '取得入库编号的8位前缀
If e.DataRow("入库编号").StartsWith(bh1) = False '如果入库编号的前8位不符
Dim max1 As String
Dim idx1 As Integer
Dim d1 As Date = e.DataRow("入库日期").Date
max1 = e.DataTable.Compute("Max(入库编号)","入库日期 >= #" & d1 & "# And 入库日期 < #" & d1.adddays(1) & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该月的最大编号
If max1 > "" Then '如果存在最大入库编号
idx1 = CInt(max1.Substring(bh1.length+1,3)) + 1 '获得最大过磅编号的后三位顺序号,并加1
Else
idx1 = 1 '否则顺序号等于1
End If
e.DataRow("入库编号") = bh1 & Format(idx1,"000")
End If
End If
这段自动编号,提示错误:
.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2018.10.9.1
错误所在事件:表,入库订单表,DataColChanged
详细错误信息:
调用的目标发生了异常。
索引和长度必须引用该字符串内的位置。
参数名: length
请问怎么改?