Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem adding record with same deleted Primary Key valu
Message
 
À
17/10/1997 12:38:29
Juan Kh
Dataprop Technologies
Sungai Petani, Malaisie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00055190
Message ID:
00055230
Vues:
29
>Hello,
>
>I worked on a table which has a primary index called "Key". This table is included in the DataEnvironment of one of my form, with Private DataSession. Problem occur when I tried to add (by APPENDing) a new record with a value which had been deleted previously. The message I got is "Uniqueness of Index KEY is violated." By PACKing the table after DELETEing a record would solve the problem. Is there any other way (other than RECALLing) which I could use back the same KEY value without having to pack the table? 'Cos I don't want to open the table as EXCLUSIVE.
>
>Thanks,
>juan

Ed's answer is correct also. I don't use APPEND BLANK but rather SQL-INSERT.
If you use a table as Ed suggested and you can get the value, increment by one and use that value as the key. If you don't use a separate table, you can SET DELETED OFF, set the order of the table to the primary key, GO BOTTOM, grab that key value and increment by one, INSERT new record, then SET DELETED ON. By setting deleted off, you include records marked for deletion when going to the bottom of the file. At the bottom, you will always have the largest # to date as long as the proper order is set.

Steve
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform