
此主题相关图片如下:t1.png

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(12,4)) + 1 '获得最大单据编号的后四位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("立案编号") = bh & Format(idx,"000") & "号"
End If
End If
End Select
第一次运行正常,之后显示错误,如下,怎么回事?

此主题相关图片如下:t2.png

[此贴子已经被作者于2014-1-3 16:15:02编辑过]