Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting records
Message
From
05/05/2003 01:33:15
 
 
To
05/05/2003 01:22:37
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00784786
Message ID:
00784788
Views:
19
>Hi everybody.
>For deleting records from the batch file, I use following code
>
>SELECT filename
>SET ORDER TO fieldname
>SET KEY TO expr
>GO TOP
>SCAN
>	DELETE
>ENDSCAN
>SET KEY TO
>SET ORDER TO
>
>I have tested it and it works, but I am not 100% sure if the code is safe? Somewhere in my mind I have a doubt, because I am filtering the records, then fetching the records one by one and deleting it. Will SCAN...ENDSCAN lose the reference of the records as any time? Am I going to confuse the fox in any case? What are the other safe ways? I cannot use DELETE ALL FOR.., because the tables and on the network and this will lock the entire file.

The DELETE - SQL command uses record locking rather than file locking, so it is one simple solution:
DELETE FROM < some table > WHERE ...
Alternately, you could use a filter condition on SCAN, e.g.
SCAN ALL FOR ...
Are you certain you're not allowed (or able) to use a file lock?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform