Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rolling back input done via insert into and replace cmds
Message
From
14/04/2003 11:13:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Rolling back input done via insert into and replace cmds
Miscellaneous
Thread ID:
00777224
Message ID:
00777224
Views:
45
This is an existing application worked on by many people, now it's my turn. Basically it is an input form for issuing stock items.
VFP 7, Save data via a save button on a form, Dataseesion set to 2 (private), Buffering set to none, 3 shared tables are used, and ordered items are save in a temporary table on the user's PC. To save an issue slip the current approach is to

1. get next slip number for requisitions header table
2. use instert into command to append a new record into the header table
3. a. scan temp items ordered table for stock number of ordered items
b. lock record in inventory table
c. use replace command to update inventory table (i.e. decrease amount on hand)
d. use insert into command append a record into detailed requitions table
e. unlock record in inventory table

This contains no error checking and works 95% of the time, but occationally it fails. I would like to add checks to be sure all updates and appends work, but I am not sure of the best approach to do this. In particular how do I check if insert into commands worked and if it failed how to I rollback the entire process. For example

1. Do I have to lock both the requisition header and detail tables, or since next issue slip number comes from the header table do lock just the requisions table?
2. Do I use tableupdate command after the insert into commands?
3. Does the rollback command also undo insert into commands?
4. Where do I need to use the tablerevert command?

Any suggestions/help appreciated.
Next
Reply
Map
View

Click here to load this message in the networking platform