Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Editing a record - conflict
Message
From
10/11/2006 10:53:20
Mike Yearwood
Toronto, Ontario, Canada
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01168682
Message ID:
01168743
Views:
15
Hi Cyril

>A back to basics question please.
>
>A table only ever has one record with three fields, dt1, dt2, dt3.
>In a multi-user environment, users will update one of these fields.
>
>Example:
>
>User 1: changes dt1.
>User 2: changes dt2.
>
>Here is the problem: When user 2 saves the changes to dt2, the changes made by user 1 to dt1 are lost.
>
>How do I ensure that all changes are accumulative. The last user to update a particular field (say dt3) should stick, but any changes made in the meantime by other users to dt1 or dt2 should not be overwritten when dt3 is saved. How can that be achieved?

Optimistic techniques require you to expect everything will work fine. You give a warning if they don't. See Andy Kramek's point #4

http://weblogs.foxite.com/andykramek/archive/2005/12/27/1077.aspx

There is no need for row buffering. Look at the following and search for

"So what mode of buffering should I use in my forms?"

http://weblogs.foxite.com/andykramek/archive/2005/10/18/948.aspx
replace dt1 with datetime() record 1 in showdate
IF NOT TABLEUPDATE(.T.,"showdate")
  aerror(laError)
  MESSAGEBOX(laError[1,2])
ENDIF
You can refresh the form if that error happens. The current user then sees the current state of the form and decides if s/he wants still wants to change it.

This is exactly the same as if the current user never got the error. Because if another user made the same change 10 minutes ago, the current user would be deciding what to do with the current record.

Mike
Previous
Reply
Map
View

Click here to load this message in the networking platform