Recording Editor's data changes

Recording Editor's data changes

safaviasafavia Posts: 36Questions: 14Answers: 0

Good day pals,
I'm trying to build a gridview with the Editor as such that beside the source SQLServer table linked to Editor, the data change history also get recorded on a separate table in SQLServer.
Basically, I have the following SQLServer table called "Employees" populated on the Editor with inline editing capability:

I want anytime someone changes Employees table's data with the Editor, the changes history also get recorded on a separate SQLServer table called "EmployeesDataChangeHistory".

For example: User Jim Warner (who is the HR manager) on 1/1/2018 10:00, changes employee John Smith's title from "Engineer" to "Senior Engineer" and changes his salary from $100,000 to $120,000 using the Editor's inline editing function.

I want Employees table and EmployeesDataChangeHistory table in SQLServer get updated as below:

Thanks so much!

Cheers,
Alan

Replies

  • Bindrid2Bindrid2 Posts: 79Questions: 4Answers: 12

    You don't want to use DataTable at all for that. Your best bet is to create a trigger in the database, itself, that will copy the changes into the log table. It is more effective since it will record changes made by a user via Editor or changes made by any other application, including ones made directly against the datatable.

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    Hi Bindrid2,
    Thanks so much for the reply. Your suggestion sounds to be a great solution. I'll need to google on how to create such trigger in sqlserver as I don't know how to do that. Thanks again!

This discussion has been closed.