Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UPDATE - SQL using Form Control Values
Message
De
29/10/2007 14:01:50
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
29/10/2007 08:06:31
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01264672
Message ID:
01264836
Vues:
14
>>I'm using the following UPDATE command in a form method:
>>
>>LPARAMETERS ;
>>	tiSessID ;
>>	, tiSitNo
>>
>>UPDATE Grads SET ;
>>	cFName = ThisForm.txtcFName.Value ;
>>	, cMInit = ThisForm.txtcMInit.Value ;
>>	, cLName = ThisForm.txtcLName.Value ;
>>	, cStreet = ThisForm.txtcStreet.Value ;
>>	, cCity = ThisForm.txtcCity.Value ;
>>	, cProvince = ThisForm.txtcProvince.Value ;
>>	, cPostCode = ThisForm.txtcPostCode.Value ;
>>	, cPhone = ThisForm.txtcPhone.Value ;
>>	WHERE iSessID = tiSessID ;
>>		AND iSitNo = tiSitNo
>>
>>All of the target table columns and form controls ( .txtc*.Value) exist. The control values are not NULL.
>>
>>When run, I get an error "Alias 'TXTCFNAME' is not found".
>>
>>If, for test purposes I replace the ThisForm.Control.Value(s) with string literal(s) the command works fine.
>>
>>Is this a known problem, that UPDATE - SQL can't make use of form control properties this way? Any workaround other than declaring local temp variables to hold the values? TIA.
>>
>>UPDATE: never mind - it's right in the VFP Help that you can't do this, and that you need to use local variables. One place where good ol' REPLACE helps out - it doesn't complain about using object properties ;)
>
>Except that, as I keep trying to get across, by using properties, you are already taking a performance hit. Also you're leaving yourself open to worse, even difficult to debug, potentially drastic hits. Just add significant access/assign methods to those properties and watch things crawl.

In this case I needed something that worked. Using object properties works fine with INSERT - SQL and SELECT - SQL, I was a little surprised they won't with UPDATE - SQL. Seems to me an inconsistency in the language, or maybe something was never finished in the implementation of the latter.

Your points about performance are well taken but in this case don't matter.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform