Quote:
Originally Posted by thek
- Hold the data needed
- Have more than one person to work in the program and updating the data (It’s not a requirement that it’s the same data/records they update (but it would be nice), but at least I’ll make a functionality that locks the data that one person is editing, so that there are no overwrite of data.
- The database MUST be on a share network
|
Use SQL Server Express
Note for item 2, you can use pessimistic locking but it is sometimes dumb. By default doing code like DW" link in my sig shows you, creates OPTIMISTIC locking, which is "hope that noone else changed the record, but throw an exception if someone did"
If 2 people d/l a record and then one changes and saves
and then the other changes and saves, he gets an exception because the query is written so that old values in the client are compared with the db values. If 0 rows are affected, it means someone changed a value
So when you get your exception you have to handle it:
Overwrite user1's changes with user2's
Keep user1's
Show user 2 both sets of changes and let them choose which of each
Merge the changes, letting user1's changes win if there is a conflict
Merge the changes, letting user2's changes win if there is a conflict
You must write this code. it is not automatic