Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to check existing data in a table?
Message
De
27/09/1999 03:36:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
25/09/1999 14:20:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00268967
Message ID:
00269213
Vues:
20
Yes, for primary index you need a database. BUT "candidate" indexes also prevent duplicates and can be used with free tables + any number of tags.
You could also add your free table to a database with "add table" command.
Cetin

>Thanks first.
>I am using a free table and I know if I am using a database, I can assign a primary key to that table, right? But now can I add this primary key to my free table if I don't have a database? Or I can change it to a database?
>Anyway, I am trying to use SEEK() for my purpose.
>>>Dear all,
>>>
>>>I have a table. When the user adds a new record, I want to check if this new record (for example, same UserID) has already exist in the table or not. How can I do that?
>>>I found in an example that it has a "Save" button and the CLICK event is:
>>>result = TABLEUPDATE(.F.) if result = .F. =MESSAGEBOX("Fail to save!"+CHR(13)+"User ID already exists";
>>>else
>>>....
>>>...
>>>It works in this example. I have tried to find any coding for checking about the existing data in this example but cannot find any idea.
>>>Anyone can help?
>>>
>>>Thanks
>>>Power
>>
>>
Power,
>>Probably sample depends on table's primary key. If UserId is primary field than tableupdate(.f.) would return .f.
>>If you don't do that with a primary key you could use other workarounds :
>>-If row buffered use the table again and seek userid in "used again" alias (use again doesn't see buffered ones).
>>-Do the same with an SQL check (it doesn't see buffered also).
>>-Also you could just use seek (lookup()). Seek would catch first entered and if its recno() # yours than its duplicate.
>>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