Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update conflict
Message
From
06/04/2000 13:50:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00356396
Message ID:
00356405
Views:
13
>I have a program that is being shared on the LAN. I have 2 users accessing the same form and record at the same time. User 1 makes modification to a table, the user 2 makes another modification to a table. My user 2 is an update conflict error 1585. The forms buffermode is set to Pessimistic and data sessions is private.
>Here is my code:
>
>r3 = tableupdate(.t., .t., 'vehicle')
>
>
>this works for updating for first user who gets to the form, but not for the second user. How do resolve this problem as far as letting the second user update, or even just check to see if there is a lock on record and display a message so that my application for the second user doesn't terminate after the standard error 1585 error message is displayed? Is there a way to unlock all records (I don't if this a good idea or not) after or prior to updates? Help much appreciated.
>
>Nick Patel

Hi Nick,

I would use Optimistic Table Buffering, then, assuming changes are made to a single record, in pseudocode do something like:
IF TABLEUPDATE( 0, .F., "Vehicle" ) && update current record, do NOT force
*  Ok, so we're outta here
ELSE   && something went wrong
*  Possibly get the error array and check for specific errors
*  Notify user, if update conflict exists, ask if they want to overwrite
*  changes made by other user.
  IF MESSAGEBOX( "Overwrite changes?", ... ) = MB_YES
*    Then TABLEUPDATE( , .T., ... ) and test for success etc.
  ELSE
     TABLEREVERT( .F., "Vehicle" ) && Discard changes
  ENDIF
ENDIF
You can use this general procedure and customize it as needed for your situation.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Reply
Map
View

Click here to load this message in the networking platform