Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MultiUser Issue
Message
From
06/08/2001 12:50:27
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00540233
Message ID:
00540246
Views:
13
This message has been marked as the solution to the initial question of the thread.
I agree with Nadya: Optimistic table buffering is the way to go. You can simulate row buffering by not allowing the user to move the record pointer and using the tableupdate command with a 0 or .f. value for the first parameter to update just the current record.

You can also check for conflicts between two users who are editing the same record by calling the checkconflicts method in the _datachecker object in _datanav class (the message it provides is crude but users will probably never see it anyway).



>What exactly doesn't work? You should use a form's property, say, EditMode, and do
>thisform.SaveAll(not EditMode,"ReadOnly",'textbox')
>thisform.SaveAll(EditMode,"Enabled",'commandbutton')
>Also this property should control, in which mode you're currently in (Save or Edit). At least, this is how it works in our framework (not a best one, I admit).

>We use optimistic table buffering and basically we don't have multi-user problems.





>>I have form whose buffer mode is pessimistic and the cursor in the data environment is pessimistic row buffering
>>(I would use OR buffering if I could get it to work).
>>The form has a that has a button that I am using for an edit/save.
>>As long as I am dealing with one user the code works fine, but
>>I have been tring for days to figure out how I can handle the issues with multiusers clicking the edit/save button.
>>
>>Here is a sample of my edit/save code:
>>
>> DO CASE
>> CASE ALLTRIM(UPPER(THIS.COMMAND8.CAPTION)) = 'EDIT'
>> ** this will handle the command buttons
>> FOR START = 1 TO 9
>> THISBUTTON = 'THIS.COMMAND'+ALLTRIM(STR(START))+'.ENABLED'
>> IF START != 8
>> &THISBUTTON = .F.
>> ELSE
>> &THISBUTTON = .T.
>> ENDIF
>> ENDFOR
>> **** this is for the textboxes
>> FOR START = 2 TO 16
>> THISBOX = 'THISFORM.RFI_TEXTBOX'+ALLTRIM(STR(START))+'.READONLY'
>> &THISBOX = .F.
>> ENDFOR
>> **** this is for the editboxes
>> FOR START = 1 TO 3
>> THISBOX = 'THISFORM.RFI_EDITBOX'+ALLTRIM(STR(START))+'.READONLY'
>> &THISBOX = .F.
>> ENDFOR
>> THIS.COMMAND8.CAPTION = 'Save'
>> CASE ALLTRIM(UPPER(THIS.COMMAND8.CAPTION)) = 'SAVE'
>> lnResult = MESSAGEBOX('Are you sure you want to save',32+4,'Save Changes')
>> IF lnResult = 6
>> DO SAVE_DATA WITH .T.
>>
>> ELSE
>> DO REVERT_DATA WITH .F.
>> ENDIF
>> *** change the textboxes back
>> FOR START = 2 TO 16
>> THISBOX = 'THISFORM.RFI_TEXTBOX'+ALLTRIM(STR(START))+'.READONLY'
>> &THISBOX = .T.
>> ENDFOR
>> ******* change the edit boxes back
>> FOR START = 1 TO 3
>> THISBOX = 'THISFORM.RFI_EDITBOX'+ALLTRIM(STR(START))+'.READONLY'
>> &THISBOX = .T.
>> ENDFOR
>> THIS.COMMAND8.CAPTION = 'Edit'
>> ** this will handle the command buttons
>> FOR START = 1 TO 9
>> THISBUTTON = 'THIS.COMMAND'+ALLTRIM(STR(START))+'.ENABLED'
>> IF START != 8
>> &THISBUTTON = .T.
>> ELSE
>> &THISBUTTON = .T.
>> ENDIF
>> ENDFOR
>> ENDCASE
>>
>>Thanks in advance
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform