Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PrimaryKey() in Free Tables
Message
De
23/05/2002 11:33:26
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Divers
Thread ID:
00660057
Message ID:
00660532
Vues:
8
Hi Mel:

>Any suggestions on how to handle this when you are importing records using the PrimaryKey() function.

Well nothing smart or anything <s>. There are a couple of ways to go here. First, you could create a wrapper program around primary key. You could pass your primary key arguments to the wrapper. If these arguments happen to specify the table and the tag name, you could call the primarykey function returning its value to a variable. Then your wrapper can do a seek on the table. If the seek is true, then hit primarykey again for another value and keep seeking until the value cannot be found. You could also "go bottom" in the table to get the current highest value in the key column, then using the cmRegistry.Setcounter() method, you could assign the highest value to the counter to avoid thousands of "hits" and then call primarykey again.

The other think you could do is before you use the primarykey function on a free table is consider the tag/key you are going to use. Look at the highest value in the table. Go into the registry manager and create a counter manually and set its value to the highest key value that exists in the table. Then in your code, use primarykey() and specify the name of the counter you manually created as the primarykey counter name argument. The primarykey will simply start from the counter's current value.

HTH
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform