View Single Post
  #4 (permalink)  
Old July 3rd, 2011, 10:50 AM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

That should work.

Usually I read data into a DataSet or Recordset, I just don't always use data binding to display and edit it. For example, suppose you bind a DataSet to a DataGridView and let the user edit the data there. That works fine if it's a single user system but the changes remain in the DataSet and don't go back to the database until you save all of the changes. If there's more than one user, how do you know you're not making duplicate or conflicting changes to the data?

In that case, I would make the user select a record to edit. Then either use the database's locking mechanism to lock it or add a LockedBy field to the table so the code can "lock" the data logically. That way two users can't edit the same data at the same time. You can also see who has a record locked if you need to.

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote