Thread: Question Choose the right start?
View Single Post
  #8 (permalink)  
Old 07-11-2009, 3:47 AM
cjard's Avatar
cjard cjard is offline
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

Quote:
Originally Posted by thek View Post
  • 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
__________________
DW1 DW2 DW3 DW4 DNU PQ
Reply With Quote