DataRowAdded
增加一行后执行,此时新增行(DataRow)已经真正增加到DataTable中。但此时BUGID应该还为空吧。这就导致max都是1了。怎么变通一下?
Dim max As String
max = e.DataTable.Compute("Max(编号)","BUG_ID = '" & e.DataRow("BUG_ID") & "'")
If max > "" Then
max = max + 1
Else
max = 1
End If
e.DataRow("编号") = max
e.DataRow.save
Tables("盖楼").Sort = "编号"
DataTables("盖楼").Save()
click代码
Dim r As Row = Tables("盖楼").AddNew()
r("BUG_ID") = Vars("BUGID")
[此贴子已经被作者于2016/3/18 16:36:19编辑过]