为什么要在AfterOpenProject事件加上以下代码,
For Each dt As DataTable In DataTables
dt.GlobalHandler.DataColChanged = True
dt.GlobalHandler.DataRowAdded = True
Next
还有DataColChanged事件为什么要增加红色部分,如果列状态为锁定,是不是就不添加记录了呢
If e.DataTable.Name <> "数据操作日志" Then
If e.DataRow.RowState = 2 Then
Return
Else
Dim dr As DataRow = DataTables("数据操作日志").AddNew
dr("ID") = e.DataRow("_Identify")
dr("用户") = User.Name
dr("涉及表") = e.DataTable.Name
dr("涉及列") = e.DataCol.Name
dr("涉及行") = e.DataRow("_Identify")
dr("时间") = Date.Now
dr("操作") = """" & e.OldValue & """ 改成了 """ & e.NewValue & """"
Dim str As String = ""
For Each c As DataCol In e.DataTable.DataCols
str += c.Name & "=" & e.DataRow(c.Name) & "|"
Next
dr("原行数据") = str '这个记录的数据是修改后的数据,并不是原行原始的数据
End If
End If