Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uniqueness of Index [Index name] violated ??
Message
 
 
À
04/06/2004 14:29:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00910050
Message ID:
00910055
Vues:
22
The problem most likely in using ALLTRIM() in the index. VFP doesn't support variable lenght keys so it has to decide in advance what the length is. As result, the index key lenght may be shorter than you expect. I don't see wht do you need ALLTRIM() at all in this case.

>I've been scratching my head trying to debug a problem form in my VFP 8 application.
>
>Table DD_dwgh is Opened (USE) with order set to Candidate (composite)
>key DH_DWGNUM (ALLTRIM(dh_dwgnum)+ALLTRIM(dh_rev)) both are Char fields.
>This should guarantee uniqueness for example disallowing INSERT of:
>dh_dwgnum  dh_rev  dh_dcn
>---------  ---     -------
>200155     A       7365585    1st rec
>200155     A       7365586    2nd rec
>
>
>This should be fine (this is what I tried, and it failed):
>
>dh_dwgnum  dh_rev  dh_dcn
>---------  ---     -------
>200155     A       7365585    1st rec
>200155     B       7365586    2nd rec
>
>
>DH_DCN is primary key (INT), and in debugging I know that there is no
>violation on following statement w. INSERT field values:
>
>INSERT INTO DD_dwgh (dh_dcn,dh_dwgnum,dh_rev,dh_rcvdate) VALUES ;
>  		    (l_nNextnum,l_cDwgnum,l_cDwgrev,DATE())				
>l_lRetval = TABLEUPDATE(1,.F.,"dd_dwgh")
>IF l_lRetval != .T.
>   dimension l_aerr[1]
>   =AERROR(l_aerr)
>   =MESSAGEBOX("I couldn't save changes to dd_dwgh."+CHR(13)+;
>                STR(l_aerr[1])+CHR(13)+ l_aerr[2],;
>  	        16,"TABLEUPDATE Failure")	
>ELSE
>   THISFORM.r_updcnt = THISFORM.r_updcnt + 1			
>ENDIF
>
>I've checked VALUES, and there are no duplications or uniqueness violations, yet I'm getting this (1884) error. Why ??
>
>I've tried to PACK, and REINDEX table set to ORDER of DH_DWGNUM (unique index); still same error appears.
>
>I've quadruple checked that there is only 1 INSERT, and 1 TABLEUPDATE executed with these field values (it is not repeated).
>
>Any ideas?
>
>Dbk
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform