Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using thisform.SomeProperty in SQL calls?
Message
From
29/06/2009 13:12:47
 
 
To
29/06/2009 12:12:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01409097
Message ID:
01409130
Views:
48
>I seem to recall having problems in the past trying to use "Thisform.Whatever" property references in certain places in a SQL call, so, now I tend to do this tecnique to get the form properties into local vars and then using the local vars in the SQL:
>
>
>lcLookupTable=this.cLookupAlias
>lcLookupField=this.cLookupField
>lcWhereClause= lcLookupTable + '=' + tcLookup
>
>Select &lcLookupField From &lcLookupTable Where &lcWhereClause Into Array laLookup
>
>
>Is this the best practice, or can I just directly reference the form properties in a SQL?
>
>Something like this...
>
>Select (thisform.cLookupField) From (thisform.cLookupAlias) where (thisform.cLookupField)=tcLookup Into Array laLookup
>
>
>That just looks like it won't even work. But it would keep me from creating all those local vars.

You can't reference object properties directly in the UPDATE - SQL command - it's actually documented in the help. AFAIK you can reference them directly in the other 3 - SELECT, INSERT, DELETE.
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
Previous
Reply
Map
View

Click here to load this message in the networking platform