Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Navigation causes a Uniqueness of Index violation Error
Message
De
05/02/2009 09:09:23
 
 
À
04/02/2009 14:34:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01379281
Message ID:
01379440
Vues:
30
>>Whenever I find a PO number at a different site I get the error message
>>
>>Uniqueness of index CRELPONO is violated.
>>
>>where "CRELPONO" is the index associated with the PO number.
>>
>>The table is buffered and the index is a "candidate" index because the user needs unique PO numbers
>>
>>I have tried to fix it unsuccessfully.. How do I fix the problem so that I do not get the error message (number 1884)?
>
>A SWAG, but perhaps do you have a row in the table with a blank or empty PO number? Maybe one that has been deleted? If the latter, you could try PACKing the table.

I agree with Al's suggestion. When I have encountered this issue, I generally find that a blank field (indexed) is in the table and has been deleted. Even if the deleted records are hidden to the viewer, Fox still see them in the index. When adding a new record, and field is initially blank. This will throw the error you are experiencing. Packing the table will help, but gaining Exclusive access to do so can cause additional problems with the end user. I have found that replacing the unique field's value with a with another random value when deleting the record will prevent the error. This does have some side-effects. The parent/child relationship to the deleted record become broken. If you are using proper RI then the new key value can be written to all child tables also.

Another suggestion would be to reuse deleted records when adding new records. When you add the record, scan the table for any deleted record, then recall it, BLANK the record, and update the fields with the new values. If no deleted records are found, then insert a new record. The true benefit to this approach is that the table do not accumilate deleted record over time. This does away with the need to Pack the tables from time to time.
Greg Reichert
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform