Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Editing a record - conflict
Message
From
10/11/2006 09:27:54
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:
01168718
Views:
16
Hi Terry

>OK. First of all, if more than one user is likely to edit the record then you could get contention. You should use record locking such as:
>
>
>select showdate
>locate
>If RLOCK()
>    replace dt1 with datetime()
>    = TABLEUPDATE(.T.)
>EndIf
>locate
>
>

Respectfully, sir, I believe you're mixing pessimistic and optimistic approaches. You've taken the pessimistic approach and locked the record while using optimistic buffering.

I also believe row buffering is seldom required. Table buffering is all I've ever needed.
replace dt1 with datetime() record 1 in showdate
IF NOT TABLEUPDATE(.T.,"showdate")
  aerror(laError)
  MESSAGEBOX(laError[1,2])
ENDIF
This way the last user to save is warned of conflicts. The optimist thinks they'll never get that warning. ;)

A refresh of the form will show the current data and the current user can decide what to do with the current record.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform