This question has no doubt been covered already but I am having trouble knowing what to search for to find an answer.
I have a .NET MVC website that is used in different countries and time zones and currently I take the .NET DateTime.UtcNow as the last amended date of a form and store it in a [datetime] field in a SQL Server 2008 database when a record is inserted/updated.
I wanted to be able to keep a log of when a user initially opened the “edit” form and then compare this to the last amended date in the database, so the user can be made aware of any further changes that occurred while they were changing the form.
I don’t know if these are the relevant types to be using.
What is the recommended way to approach the above behaviour?
It sounds like you are looking for a proactive optimistic concurrency check. You can certainly use a datetime field for this assuming that level of granularity is ‘good enough’. If you’re not sure, I would recommend using an integer instead that increments with each update – no granularity problems there.