全局表事件,DataColChanged,报错如下:新增行没问题,克隆行和合并导入就报错。求指点
Exception has been thrown by the target of an invocation.
There is no Original data to access.
目标的异常被抛出的一个调用。
没有原始数据访问。
代码如下:
If e.DataTable.Name <> "WorkLogfile" Then
If e.DataRow.RowState = 2 Then
Return
Else
Dim dr As DataRow = DataTables("WorkLogfile").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 = ""
Dim str1 As String = ""
For Each c As DataCol In e.DataTable.DataCols
str += c.Name & "=" & e.DataRow.OriginalValue(c.Name) & "】,【"
str1 += c.Name & "=" & e.DataRow(c.Name) & "】,【"
Next
dr("原行数据") = str
dr("改后数据") = str1
End If
End If