可以考虑在表事件BeforeSave中写代码
- Dim tbl As SmGrid=Proj.CurrentSmGrid
- '获得当前表中有过修改过的所有行记录
- Dim dtChanges As DataTableHelp=tbl.DataTableHelp.DataTable.GetChanges(DataRowState.Modified).GetDataTableHelp()
- If dtChanges IsNot Nothing AndAlso dtChanges.DataRows.Count>0 Then
- Dim sb As New StringBuilder
- For Each dr As RowData In dtChanges.DataRows
- '遍历所有列
- For Each dc As ColData In dtChanges.DataCols
- '如果初始值与当前值不一样
- If dr(dc.Name,DataRowVersion.Original)<>dr(dc.Name,DataRowVersion.Current) Then
- sb.AppendLine("列【" & dc.Name & "】从原始数据【" & dr(dc.Name,DataRowVersion.Original) & "】修改为【" & dr(dc.Name,DataRowVersion.Current) & "】")
- End If
- Next
- Next
- End If
- '获得新增行的数据
- Dim dtAdd As DataTableHelp=tbl.DataTableHelp.DataTable.GetChanges(DataRowState.Added).GetDataTableHelp()
- '获得删除行的数据
- Dim dtDelete As DataTableHelp=tbl.DataTableHelp.DataTable.GetChanges(DataRowState.Deleted).GetDataTableHelp()
复制代码
相关帮助文档介绍
http://www.sanmugrid.com/help/index.htm?page=00445IsNull.htm
http://www.sanmugrid.com/help/in ... %BC%95%E5%99%A8.htm
http://www.sanmugrid.com/help/index.htm?page=00420RowData.htm |