Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object reference lost in SQL SELECT ?
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01120146
Message ID:
01120306
Views:
22
>Hi Igor,
>
>It has nothing to do with macro substitution. IMO, the problem is that '.' (dot) is used for 'object.property' and for 'workarea.field'. It leads to ambiguity which VFP doesn't handle very well in SQL commands.
>My sugesstion to use TEXTMERGE doesn't eliminate macro substitution but makes building quieries easier and simplifies maintanance. It also allows to evaluate constatnt values, like properties, at the time when query is build which could be a good or bad thing depending on your requirements but it certanly eliminates the problem with oobject properties references in the field list.
>
>TEXT TO cSQLStatement TEXTMERGE NOSHOW PRETEXT 15
>SELECT column1, column2, "<<alltrim(object1.object2.property1)>>" as column3,
>    alltrim(cursor1.LastName) + ", " + cursor1.FirstName as FullName
>FROM cursor1
>INTO CURSOR cursor2 READWRITE
>ENDTEXT
>&cSQLStatement
>
I think textmerge is the best approach. We're using it here almost everytime.

I just like to point, that alltrim(cursor1.LastName) + ", " + cursor1.FirstName should probably be converted to
padr(alltrim(cursor1.LastName) + ", " + cursor1.FirstName,60)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform