Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify if a field already exists in a table
Message
 
À
03/08/2007 18:04:44
Felix Serra
Campus Management Corp.
Miami, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01238247
Message ID:
01245912
Vues:
35
>Fred Taylor's solution is what I use. It's short, clean, and to the point. No need to complicate or write useless code if this does the very same thing.

In my case, and keep in mind that is just my personal preference I am not saying your code is useless, I try never to use a generic function to get a particular result when there is a function which has been written specifically to address that particular need, in this case the Field() function specifically addresses the original poster question so I would use it even if Type returned the correct result always, which is not the case by the way, there is a thread somewhere but I think the gist of it is something like this (I think there are better examples in the aforementioned thread)
create cursor yourtable (yourfield I)

yourtable	= Createobject('Empty')
Addproperty(yourtable, 'fieldname', 'Object')

? TYPE("yourtable.fieldname") <> "U", Empty(Field('fieldName'))
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform