Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto Increment Primary Key
Message
 
À
24/05/1998 20:17:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00101564
Message ID:
00101791
Vues:
70
Create a table, say "TableKeys" with the following fields:
TableName C(8)
KeyValue Integer

and load them with the Uppercase names of your tables and beginning integer values for the primary keys (which should be surrogate keys, by the way).
Make a stored procedure to fetch the keyvalue for a table and immediately replace it with an incremented value. You don't care about holes because the key is a surrogate key and not visible to the user. You can't use a trigger to increment the keyvalue because you can't use the REPLACE command in a trigger. So, call your procedure from the "Default Value" option of the primary key in the Table Design mode.

>Since VFP doesn't have an auto-increment field,
>how have others done their increment for web
>applications?
>
>I am using VFP tables and "ADO", we can't use any
>locking schemes.
>
>I don't want to use Access (too corruptable) or
>SQL Server (extra cost by my web hosting service).
>But those two databases do offer auto-increment.
>
>I was thinking of using Application variables
>but since every table has a primiary key,
>there would be too many Application variables.
>
>So once again ... how are you incrementing
>your primary keys from VB Script to VFP tables?
Nebraska Dept of Revenue
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform