If e.DataCol.Name = "编号_年份" Then
If e.DataRow.IsNull("编号_年份") Then
e.DataRow("编号_序列号") = Nothing
Else
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(编号_序列号)","编号_年份 = #" & e.DataRow("编号_年份") & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该年的最大序列号
If max > "" Then '如果存在最大序列号
idx = CInt(max.Substring(1,3)) + 1 '获得最大序列号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("编号_序列号") = Format(idx,"000")
End If
End If
帮我看一下这个代码错在哪里,序列号无法自动生成
![dvubb 图片点击可在新窗口打开查看](skins/default/filetype/png.gif)
此主题相关图片如下:捕获.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-9/2014981682297199.png)
![dvubb 图片点击可在新窗口打开查看](skins/default/filetype/png.gif)
此主题相关图片如下:捕获1.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-9/2014981682289742.png)
年份是获取的系统日期中的年
[此贴子已经被作者于2014-9-8 16:09:34编辑过]