Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append a new record
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00615893
Message ID:
00615906
Vues:
15
>Hi all,
>
>I have the following program. Every time, when I run there is an error message: "Uniqueness of index key "cross_key" is violated" then I check the db, I find one record is add but the key fields(CROSS_ID, CURM_D) are null.
>
>set exac on
>sele pc_quota
>set order to cross_key
>if findrecord == .F.
> allocat_array(1,1) = '01/2001'
>endif
>
>i =1
>count_u =0
>count_new =0
>j = alen(allocat_array,1)
>if messagebox('Are you sure to update?',4,'Confirm message') = 6
> for y = 1 to totalmonth +1
> txt_d = 'txt_d' + allt(str(y))
> txt_q = 'txt_q' + allt(str(y))
>
> select pc_quota
> scan for thisform.&txt_d..value == allocat_array(i,1) and cross_id == crossid
> if found()
> replace curm_quo with allt(thisform.&txt_q..value )
> count_u = count_u+1
> i=i+1
> else
> append blank
> replace cross_id with crossid
> replace curm_d with thisform.&txt_d..value
> replace curm_quo with thisform.&txt_q..value
> count_new = count_new+1
> endif
> endscan
> if i>j
> i=1
> endif
>
> endfor
>

A couple of things jump out.
Where are you setting a value for crossid?
I don't think that a scan command will set the value of found() in which case you will always be appending.

HTH
Caroline
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform