Visual Basic是否以某种形式支持宏替换 [英] Does Visual Basic support macro substitution in some form
问题描述
大家好
我是一个视觉foxpro开发人员,只是学习视觉基础. Visual Foxpro支持宏替换.我无法在Visual Basic中找到类似的东西.让我解释一下在VB中被称为别的东西的意思.
在VFP中,您可以创建类似于以下内容的变量:
strCommand =从"
中选择*
strTable =产品"
然后我们将它们串联起来:
strSqlSelect = strCommand + StrTable
这样strSqlSelect =从产品中选择*"
然后我们发出如下的宏替换:
&strSqlSelect
&"号(指示宏替换)指示编译器忽略变量,但在变量内部执行命令.
VB有类似的东西吗?我正在尝试开发一个linq命令,该命令将根据传递给该命令的变量的值查询几个不同的表.我只看到了每个查询分别键入的示例.有人有例子吗?
感谢您的帮助.
Larry
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
推荐答案
我相信VB中没有宏替换之类的东西.多年前,当我使用dBASEIII时,我经常使用宏替换.因此,当我以后开始使用其他语言时,我要寻找的东西之一就是宏替换.到目前为止,我找不到类似的东西.
有人可能说这是因为dBASEIII被解释而不是被编译.我没有使用Visual FoxPro,但我相信它已经编译.我想了解更多有关此主题的信息.
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.
这篇关于Visual Basic是否以某种形式支持宏替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!