Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formatting SQL command for SQLExec()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00602973
Message ID:
00603038
Views:
22
>So, I then hit on the idea of loading the SQL statement in with a
>TEXT...ENDTEXT command such as:
>
> TEXT TO m.pcSQLCommand
>
> SELECT OrderNo, CustNo, CustName, ShipCity
> FROM OrderHdr
> WHERE OrderNo = 'm.pcOrderNo'
>
> ENDTEXT
>
>This is more readable but it has some drawbacks such as resolution of the VFP
>memory variable. I tried doing a macro substitution of the m.pcOrderNo
>variable but it would not do the substitution within the TEXT...ENDTEXT
>command. It also would not resolve it when the m.pcSQLCommand variable was
>passed to the SQLExec()function. I had to add a SUBSTR() function after the
>TEXT...ENDTEXT command to substitute the string m.pcOrderNo with the actual
>value of the variable.

From the VFP help on TEXT...ENDTEXT:

"Expressions, functions, memory variables, and array elements specified with TextLines are evaluated only if SET TEXTMERGE is ON and must be enclosed in the delimiters specified by SET TEXTMERGE DELIMITERS. If SET TEXTMERGE is OFF, the expressions, functions, memory variables, and array elements are output as literals along with their delimiters.

For example, today's date is output if SET TEXTMERGE is ON and a text line contains << DATE( ) >>. If SET TEXTMERGE is OFF, << DATE( ) >> is output literally. "
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Reply
Map
View

Click here to load this message in the networking platform