1、以下代码写到文件库表事件的DataRowAdded中
e.DataTable.save()
Dim pr As DataRow = e.DataRow.GetParentRow("案卷库")
If pr IsNot Nothing Then
pr("卷内份数") = e.DataTable.DataRows.Count
End If
2、以下代码写到文件库表事件的BeforeDeleteDataRow中
e.DataTable.save()
Dim pr As DataRow = e.DataRow.GetParentRow("案卷库")
If pr IsNot Nothing Then
pr("卷内份数") = e.DataTable.DataRows.Count-1
pr("总页数") = DataTables("文件库").Compute("Sum(总页数)","[案卷号] = '" & e.DataRow("案卷号") & "' and _Identify <> " & e.DataRow("_Identify"))
pr("起止日期") = DataTables("文件库").Compute("min(成文日期)","[案卷号] = '" & e.DataRow("案卷号") & "' and _Identify <> " & e.DataRow("_Identify")) " - " DataTables("文件库").Compute("max(成文日期)","[案卷号] = '" & e.DataRow("案卷号") & "' and _Identify <> " & e.DataRow("_Identify"))
End If
3、以下代码写到文件库表事件的DataColChanged中
e.DataTable.save()
Dim pr As DataRow = e.DataRow.GetParentRow("案卷库")
If pr IsNot Nothing Then
pr("总页数") = DataTables("文件库").Compute("Sum(总页数)","[案卷号] = '" & e.DataRow("案卷号") & "'")
pr("起止日期") = DataTables("文件库").Compute("min(成文日期)","[案卷号] = '" & e.DataRow("案卷号") & "'") " - " DataTables("文件库").Compute("max(成文日期)","[案卷号] = '" & e.DataRow("案卷号") & "'")
End If