Select e.DataCol.Name
Case "MLMC","MLLB"
If e.DataRow.IsNull("MLMC") OrElse e.DataRow.IsNull("MLLB") Then
e.DataRow("MLBH") = Nothing
Else
Dim bfry As String = e.DataRow("MLLB")
If e.DataRow("MLLB") = "MM1" Then
bfry = "SZ"
ElseIf e.DataRow("MLLB") = "MM2" Then
bfry = "ZZ"
ElseIf e.DataRow("MLLB") = "MM3" Then
bfry = "HB"
ElseIf e.DataRow("MLLB") = "MM4" Then
bfry = "WF"
End If
Dim bflx As String = GetPy(e.DataRow("MLMC").substring(0,2) ,True)
Dim bf As String = "ML"
Dim d As Date = Date.Today()
Dim bh As String = bf & Format(d,"yy") & bflx &Format(d,"MM") & bfry & Format(d,"yy") & "-"
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(MLBH)","MLBH like '" & bh & "%'")
If len(max) = 14 Then '如果存在最大编号
idx = CInt(max.Substring(bh.Length)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("MLBH") = bh & Format(idx,"000")
End If
End Select
能帮我看一下吗?不能按序编号,不知道是怎么回事。