Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT - SQL and macro/name substitution
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00057491
Message ID:
00057498
Vues:
32
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform