Take the 2-minute tour ×

I have an asp.net application with c# code-behind. This application is a dispatch system which allows the user to create a 'ride' (stored in a microsoft sql db) which is modified through various processes as its status goes from waiting>enroute>completed etc.. I am trying to find the best way to 'save' the previous state of this 'ride' db row before it is modified, thus enabling the user to 'undo' their previous changes. What might be the best construct to accomplish this? I considered using view-state, but since there will be many many 'rides' there must be a better way..

share|improve this question

4 Answers 4

up vote 1 down vote accepted

I would do this inside the database by creating a "history" table. Upon an "undo", simply revert the data back to the history that was saved.

share|improve this answer
This may indeed be the way to go. I'm new to ASP.NET and wanted to make sure I wasn't missing something else I could do. Thanks. –  SHeinema Feb 23 '12 at 6:00

Is undo state something transient (they can only undo while they're doing the current ride), or is it permanent (they can leave the app, come back to a ride they created a year ago, and press undo)?

The former would be a good candidate for viewstate. The latter necessitates a history table as in @Induster's answer.

I doubt the amount of state will significantly affect server performance. Test it out and see!

share|improve this answer
I was initially thinking that transient would be enough, but given the users in my case I think permanent may be the way to go. Or perhaps I could resolve the issue of this doubling the size of my db, with limiting 'undo' operations to 24 hrs, then deleting data older than this in the history table. Thanks for the input. –  SHeinema Feb 23 '12 at 5:59

Maybe slowly changing dimensions is the answer http://en.wikipedia.org/wiki/Slowly_changing_dimension

share|improve this answer

Your Answer


