Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New Number
Message
 
 
À
20/11/2000 13:52:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00443749
Message ID:
00443765
Vues:
10
>I have a table that has pool, hand and number fields. If the user wants to add a new record, I check the table for the pool that the user wants to add a record for. If it isn't in the table, I give that record a number of 1. If it is I want to increment the last number for that pool by one. So there would be multiple records with the value of 1 or any other number for that matter. I can't think of a way to do this. Any help would be appreciated.Thanks,
>
>Tyler

Off the top of my head:
lparameters tnpoolID
lnretval = 0
use pool_table  &&;-)
=cursorsetprop("buffering",2) && pessimistic row
if !seek(tnpoolID) then
   insert into pool_table (key, value) values (tnpoolID,1)
   lnretval = 1
else
   replace key with key && lock record so no one else can get it
   lnretval = key + 1
   replace key with lnretval
endif
if tableupdate() then
   return lnretval
else
   return 0  && error occurred; parse aerrors to find out what
endif
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform