If e.DataCol.Name = "ajclqh_tijiaoqh" Then If e.DataRow.IsNull("ajclqh_tijiaoqh") Then e.DataRow("ajdjh") = Nothing Else Dim d As Date = Date.Today Dim y As Integer = d.Year Dim fd As Date = New Date(y,1,1) Dim ld As Date = fd.AddYears(1) Dim bh As String = y & "-" Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(ajdjh)","y >= #" & fd & "# And y < #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify")) If max > "" Then '如果存在最大编号 idx = CInt(max.Substring(bh.Length)) + 1 '获得最大编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("ajdjh") = bh & Format(idx,"000") End If End If
|