Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Build, looses my .mem files
Message
De
06/09/2000 19:03:33
 
 
À
06/09/2000 18:51:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00413218
Message ID:
00413237
Vues:
17
>Someone mentioned this before.
>
>How do you do that?
>
>Would you have a sample code of this process?

In the Tastrade example is a good one - for the id generation.
This is a basic version of what it does,
** create a function or PRG or stored procedure 
** called GetNextCustNum()
IF !USED("custnum")
  USE custnum IN 0
ENDIF
SELECT custnum
lnNextNum = inextnum
REPLACE inextnum WITH inextnum+1
RETURN lnNextNum

** create the incrementing table
** this table will stay at 1 record
CREATE TABLE custnum ( ;
  inextnum i)
INSERT INTO custnum VALUES (1)

** put it to use
** like as a default in a field in a database table
CREATE DATABASE mydata
CREATE TABLE custtest ( ;
  icustnum i PRIMARY KEY DEFAULT GetNextCustNum(), ;
  ccustname c(30) )
APPEND BLANK && icustnum now = 1
APPEND BLANK && icustnum now = 2
APPEND BLANK && icustnum now = 3 (etc...)
Be aware that if you use INSERT INTO custtest FROM MEMVAR to make the default fire, m.icustnum cannot exist.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform