Select e.DataCol.Name Case "登记日期","类别" If e.DataRow.IsNull("登记日期") OrElse e.DataRow.IsNull("类别") Then e.DataRow("编号") = Nothing Else Dim d As Date = e.DataRow("登记日期") Dim y As Integer = d.Year Dim bh As String = e.DataRow("类别") & "[" & Format(d,"yyyy") & "]" '生成编号的前缀 If e.DataRow("编号").StartsWith(bh) = False '如果立案编号前缀不符 Dim max As String Dim idx As Integer Dim flt As String flt = "类别 = '"& e.DataRow("类别") & " 'And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(编号)",flt) '取得区划机关行为简称的最大单据编号 If max > "" Then '如果存在最大立案编号 idx = CInt(max.Substring(8,3)) + 1 '获得最大单据编号的后四位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("编号") = bh & Format(idx,"000") End If End If End Select 老师,这段代码我跨年之后怎么从001自动开始呢?比如2015年?
|