Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERT - SQL and macro/name substitution
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00057491
Message ID:
00057498
Views:
26
>I have a button bar class with properties that hold the names of the aliases used for the form and its grid. The method for adding records has some code which uses INSERT - SQL. Since it's a class, the alias names can't be hard-coded, of course. They need to come from the class property, which is filled in the instance of the form. I'm trying various ways to use macro or name substitution, but I can't get the syntax right. My latest attempt goes like this:
>
>cAlias1 = THIS.Parent.Alias1;
> +'('+THIS.Parent.FieldName1;
>+','+THIS.Parent.FieldName2+')'
>INSERT INTO &cAlias1. VALUES(var1,var2)
>
>I also tried INSERT INTO (cAlias1) VALUES(var1,var2) and I still get syntax errors.

Build the entire query into a string like:

thequery = "INSERT INTO " + calias + ... blah blah blah

and then issue the query with macro subs:
&thequery
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform