“RK”是加的前缀,增加行的时候报错,未找到列[RK]
Dim bh As String = "RK" & "-" & Format(Date.Today,"yyMMdd")
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(单号)","单号 Like '" & bh & "*'" )
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(10,4)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("单号") = bh & "-" & Format(idx,"0000")