Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update doesn't work without thisform
Message
De
29/09/2011 19:35:08
 
 
À
29/09/2011 15:28:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01525200
Message ID:
01525215
Vues:
77
>I do an update with set
>
>
>UPDATE MyView ;
>	SET ;
>		Field1 = nValue1, ;
>		Field2 = .nSomeValueIHave ;
>	WHERE code = nValue3
>
>this gives an error even if there is a WITH in the beginning of that procedure
>
>
>UPDATE MyView ;
>	SET ;
>		Field1 = nValue1, ;
>		Field2 = thisform.nSomeValueIHave ;
>	WHERE code = nValue3
>
>doesn't give an error
>
>
>What's wrong here?

It's a limitation of the UPDATE - SQL command - it doesn't accept object properties. From VFP help:

"If you want to use an object property in an expression, you need to specify a memory variable and then use that variable in the expression. For example, you can specify x = oColField("iid").Value and then use the SET clause set iid = x in your UPDATE - SQL command. If you use the object property, that is objectname.property, directly in the expression, the command uses it as an alias and fails."

Are you sure your second code sample actually works, and gives the results you expect (i.e. doesn't fail silently)? If so, that might be an interesting exception to the limitation pointed out in the help.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform