Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom message in uniqueness of fields
Message
De
04/03/2003 03:51:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/03/2003 02:17:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00760764
Message ID:
00760780
Vues:
15
>hello,
>
>i created a table employee and created primary index on empno. when i created a form with a button ADD. it simply: APPEND BLANK.
>
>if i try to input record, it checks for the uniqueness of my field empno. this is fine, but how do i change the default foxpro message (uniqueness of.. etc..) to my own message (empno already exists)?
>
>i've been using foxpro for windows for 2 years, and i'm new to visual foxpro. pls help.

You can check if empno already exists :

if indexseek(m.empno,.f.,'myTable','empno') && exists
*Display your own message here
endif

However an easier way is not to make empno (or anything that's entered by users) a primary key. A primary key should be generated and used by you only IMHO. That way you can check if that exists anytime you want :
lnEmpno = mytable.empno
lnMyPrimaryKey = myTable.PKid
select cnt(*) from myTable ;
 where empno = lnEmpNo and pkid # lnMyPrimaryKey ;
 into array arrExists
if arrExists > 0
 && empno exists
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform