Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Evaluate statement
Message
 
 
To
10/12/2000 12:36:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00451358
Message ID:
00451378
Views:
21
Tom,

Eval() can only evaluate something that would be valid on the right hand side of an =

Also you don't have to macro expand the whole command, I find it a little cleaner to write runtime generated select statements like this:
lcTable = "AUTHORS"
lcCursor = "TEMPCURSOR"

SELECT * ;
   FROM &lcTable ;
   INTO CURSOR &lcCursor
but this is only needed where you are changing things like where clauses on the fly. Your code since it is only replacing named items you can use name expressions instead:

SELECT * ;
FROM (lcTable) ;
INTO CURSOR (lcCursor)

>What should this EVAL be returning?
>Just a string that is created in lcSQL or a cursor.
>Plus I keep getting this ")" error on the EVAL line? I dont see a missing ")"
>
>lcTable = "AUTHORS"
>lcCursor = "TEMPCURSOR"
>
>lcSQL = "SELECT * FROM " + lcTable + " INTO CURSOR " + lcCursor
>
>EVAL(&lcSQL)
>
>I would like to use a variant of this in a program that I could use when I need it. Almost like attaching to buttons on a form.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform