Click here to Skip to main content
15,116,354 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All

I am a visual foxpro developer just learning visual basic. Visual Foxpro supports macro substitution. I have not been able to find anything like it in visual basic. Let me explain what I mean in case it's called something else in VB.

In VFP you can create variables similar to the following:

strCommand = "Select * from "
strTable = "Products"

Then we concatenate them:

strSqlSelect = strCommand + StrTable
so that strSqlSelect = "Select * from Products"

Then we issue a macro substitution as follows:

&strSqlSelect

The ampersand (indicating macro substitution) instructs the compiler to ignore the variable but to execute the command inside the variable.

Does VB have anything similar. I am trying to develop one linq command that will query several different tables based upon the value of the variable passed to the command. I have only seen examples where each query is typed separately. Does anyone have an example.

Thanks for your help.

Larry
Posted

1 solution

I believe there is no such thing as macro substitution in VB. I used to use macro substitution a lot when I was using dBASEIII many years ago. So when I later started to use other languages one of the things I was looking for was macro substitution. Up to now I cannot find anything like that.

Some people may say it is because dBASEIII was interpreted, not compiled. I have not used Visual FoxPro, but I believe it is compiled. I would like to see more on this topic.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900