Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uniqueness of index ... is violated
Message
De
23/07/2002 04:53:23
 
 
À
23/07/2002 04:41:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00681498
Message ID:
00681499
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
>Hi
>
>In my form , i use buffer .
>I have a table with one index candidate in field codigo .
>
>When user make a new record , can write in field codigo .
>
>So in Valid (TexBox) , i make :
>Select MyTable
>GO TOP
>SEEK codigo
>IF Found()
> RETURN .F.
>ELSE
> RETURN .T.
>ENDIF
>
>
>
>But , the VFP give me error Uniqueness of index codigo is violated .
>
>I don´t want see that error , i want see my error message in portuguese .
>I know that i can , use ON ERROR .
>But that is the better way ?
>
>I want use one index candidate , but i don´t want see message Uniqueness of index codigo is violated , in english .
>
>How many ways i can do ?
>And , What is the better way ?
>
>Thanks

Pedro,

(1)
It may be that the record with codigo is already in the table and was deleted.
if you have SET DELETED ON, the seek(codigo) will return .F. if that record was deleted

solution
a)
local sDeleted, AlreadyIn
sDeleted = set('Deleted')
set Deleted Off
AlreadyIn = seek(codigo)
set Deleted &sDeleted
return !AlReadyIn

b) modify the Candidate key and use the filter for !deleted()

2) if you want the error messages in your own language you will have to trap them in the error routine of your form.
See the tastrade example for how to do that
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform