Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Thought I'd Run This One by Everybody First.....
Message
 
 
À
27/07/2000 08:42:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00397485
Message ID:
00397512
Vues:
9
>How do you find the correct record to update? Does SQL automatically find it by the key value in the SQL string? Please tell me it is so!
>
>DP

No, you have to have a Key field.

update mytable set somefield = somevalue where keyfield = keyvalue

Every table should have a primary key field for this very reason. The best way is to create a surrogate [meaningless] key that is of integer data type. This value is never changed and users certainly can not change it. In VFP, my default value for this field is GetKeyID('tablename', 'fieldname'). The GetKeyID is a stored procedure in my DBC. I have a KOUNTERS table that has 3 fields -- TableName, FieldName, LastID. I pass a field name because I do have tables that have more than 1 field that I use an ID generator for although only 1 of the fields is the Primary Key. I do not have PKs that are composed of 2 or more fields.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform