Best Practice: Flagging Changed Rows

M

Mario T. Lanza

I am developing an ASP class that allows users to view/edit many
records in a table directly via their browser. In order to reduce the
number of SQL statements being executed against the database I am
storing hidden input fields that I am using to determine whether or
not changes have occurred against a given row.

I've been able to do this in two possible ways.

1) I've stored the original values of the displayed fields in hidden
variables and use them for comparison purposed to determine if changes
have occurred.

2) I've stored one hidden input named "Modified" per row. Then on
each field I flag the corresponding Modified field via client-side
script whenever a field is changed.

The first method is more accurate but, I believe, has much more
associated overhead. It's more accurate that the second method in
only uncommon situations, such as the one described:

The user changes the value of a given field on a particular record
then, thinking better of the change, he reverts to the original value.
Using the first method, no update would be detected on the row.
Using the second method, an update would be detected though none has
been made.

If anyone considers one method better than the other please offer your
reasoning.

Mario T. Lanza
Clarity Information Architecture, Inc.
 
M

middletree

You can make an entirely new table called an Audit table. Search the SQL
Server Programming forum for details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top