Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I'm not a DOS programmer anymore
Message
De
26/12/1999 19:21:15
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00308656
Message ID:
00308673
Vues:
18
>I have some processing of records to do & I'm thinking like a DOS programmer. Please help me think like a VFP programmer.
>
>I have a table on a floppy disk named people. I have a table in my project called people (which I've given an alias of peo). I want to read through the table on drive a, check to see if it's in people & replace certain fields if it is or add the record it it's not.
>
>In DOS, I said
>select 1
>use a:people
>sele 2
>use people alias peo
>set order to dnumber
>sele 1
>do while not eof()
> sele 2
> seek people.dnumber
> if found()
> replace ...
> else
> appe blank
> replace ...
> endif
> select 1
> skip
>enddo
>
>How do I do this in VFP?
>
>Many, many thanks for your help.

Without rethinking it:
USE a:people ALIAS PeoChanges
USE people ALIAS peo ORDER dnumber in 0
SET RELATION TO dnumber INTO peo
LOCATE
LOCAL oPeopleRecord
SCAN 
   IF  ! EOF('peo')
      REPLACE ...
   ELSE
      SCATTER NAME oPeopleRecord
      INSERT INTO peo FIELD (dnumber) VALUE (oPeopleRecord.dnumber)  && Assumed key
*      SELECT peo                 && uncomment these lines to copy all
*      GATHER NAME oPeopleRecord  && identically named fields from 
*      SELECT PeoChanges          && PeoChanges into new Peo record
   ENDIF
ENDDO
Obviously, no error checking, and there are a bazillion different ways to do this.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform