Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overcome the key uniqueness violated
Message
De
14/06/1998 11:22:17
 
 
À
14/06/1998 07:11:57
Tan Gay Cheong
Cybercomp Computer Services
Singapore, Singapour
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00107980
Message ID:
00108000
Vues:
23
>I have a table with a candidate key.
>When I append blank, and delete it, leaving the candidate key field blank.
>
>And when I try to append another blank record, the error msg
>" Uniqueness of Index feildname is violated "
>
>What can I do to overcome this problem?
>Should I set the UNIQUE OFF or ON in the form initialise event, will it help?

Create your candidate index on field FOR !deleted(). Beware that indexes using a FOR clause are not rushmore optimizable, so if this is a large table, adding records will be slowed considerably. To get rushmore optimization in queries though, just create another identical index without the FOR clause.

FWIW, this is why I am usually very cautious about using candidate keys, and I usually take care of checking for duplicates myself in the code that adds records. Currently this has to be done with a second alias of the cursor open to search for the value, but with 6.0 INDEXSEEK() will handle this nicely.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform