Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keylist for Primary Key Stored Proceedure
Message
De
16/12/1998 18:44:44
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Keylist for Primary Key Stored Proceedure
Divers
Thread ID:
00168325
Message ID:
00168325
Vues:
68
Hello Developers

I am stuck on a step that I need to learn to auto-generate primary keys for multiple tables. A developer this morning was kind enough to help me with the stored procedure, which is the following:

FUNCTION GetKey

PARAMETER lcKeyName

LOCAL lnKeyNum

IF NOT USED("keylist")
USE keylist IN 0
ENDIF
IF SEEK(ALLTRIM(lcKeyName),"keylist","idxkname")
REPLACE keynum WITH keynum+1 IN "keylist"
lnKeyNum = keylist.keynum
ELSE
lnKeyNum = 0
ENDIF
USE IN keylist
RETURN lnKeyNum
_______________
The code is fine, however, I am running into trouble with the associated keylist table [i believe... ]. I created a table called keylist with two fields: KeyName and KeyNum

In the keyname field I have added all 6 of my tables as a seperate record, with a keynum of 1

In each of my 6 tables, I have placed the phrase >
getkey('tablename') in the default value box.

When I go to my tables to test it out, I can't even append a record. I get an error message that says 'index tax not found' .. proceedure canceled.

What am I doing wrong?

I would appreciate any help. Thank you

jason
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform