Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Updating records in table via SCAN loop
Message
From
06/06/2002 15:52:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Problem Updating records in table via SCAN loop
Miscellaneous
Thread ID:
00665663
Message ID:
00665663
Views:
50
I previously ask about this problem and got some suggestion. I had to do some other tasks but can now get back to this problem. Background, VFP 7, multi-user, files are on a Novell server. There is an error handler but it is NOT triggered by update failures.

The problem is that occasionally the 1st record of "n" records is not update. rest are (according to the user). Records are update individually. I need to force the update if it fails.

The general structure of the code is
SELECT vietms
SET ORDER TO TAG ordkey IN vitems

SEEK table2.field2 IN vitems

SCAN FOR vitems.clordno = Order_List.cordno  
  some calculations
  RLOCK(inventory table')
  REPLACE field with value
  ...
    IN inventorytable

  TABLEUPDATE(0,.T.,'inventorytable')
  UNLOCK IN inventorytable

ENDSCAN
Several potential problems where pointed out. I would appreciate suggestions on how to check for them and if possible simulate them in a single user situation.

1. REPLACE command works most of the time, how do I check when it does not and what information about the what happend.
2. It was suggested that an EOF was reached, what is best way of checking and what should I do if it occurs.
3. Some one suggested using
SELECT inventorytable
REPLACE field WITH value
instead of
REPLACE field WITH value IN inventorytable
if I do that then I have to re-select vitems to update a field in it. What are the overhead and consequences of doing this.
4. Another suggestion was to use TABLEUPDATE()
Next
Reply
Map
View

Click here to load this message in the networking platform