Select e.DataCol.Name
Case "name"
If e.DataRow.IsNull("name") Then
e.DataRow("lei2") = Nothing
Else
Dim lb As String = e.DataRow("name")
If e.DataRow("lei2").StartsWith(lb) = False '如果单据lei2前缀不符
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(lei2)","name = '" & lb & "' And [_Identify] <> " & e.DataRow("_Identify")) '取得该类别的最大lei2
If max > "" Then '如果存在最大lei2
idx = CInt(max.Substring(2,3)) + 1 '获得最大lei2的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("lei2") = lb & Format(idx,"000")
End If
End If
End Select
这个代码 如果 name的位数不是固定的 应该怎么改?
因为是商品名 每个名字的位数都不是固定的。
麻烦各位大师指点一下