Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete records
Message
De
04/08/2004 05:14:19
 
 
À
04/08/2004 04:33:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00930569
Message ID:
00930584
Vues:
11
Mohammed

You select 2 then do a loop in that table. In the loop you try find a record. If you find it you delete that record, then select 1, skip in 1, then you're back in your loop. Only you're no longer in 2 to do the next locate.

I assume you're trying to delete all the recs in ali123 where char3 matches char3 in ali. The following goes through ali and deletes all in ali123 that match each in ali.
use ali in 0
use ali123 in 0 
Select ali
Go TOP
Scan
  m.char3 = Char3      
  Select ali123
  DELETE ALL FOR CHAR3 = m.Char3   && This equivalent to your do loop - 1 line
EndScan
Note that if you use SCAN then you don't need to reselect the table you're scanning
By the way, better than "Do while .T. ... SKIP ... If EOF() EXIT" is "Do while not EOF() ... SKIP". And better than this is Scan ... EndScan.
If you select area 0 then you don't need worry about the number, it selects the next available. Then you select your table by its alias, not it's area number. It's easier for you to do and makes the code a lot clearer.

Terry

>hi,
>
>thank you for reply.
>
>i'll try befor ,but the same result,
>
>CLOSE all
>  SELECT 1
>   USE ali
>     m.char3=char3
>  SELECT 2
>   USE ali123
>DO WHILE .t.
>
>    LOCATE for ali123.char3=m.char3
>       IF FOUND()
>        DELETE
>
>         SELECT 1
>         skip
>           IF EOF()
>             EXIT
>           ENDIF
>      endif
>enddo
>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform