Vbscript 如何在ASP中的多行表达式中向每行末尾添加注释?
在ASP(使用VBScript)中,有没有办法在较长的多行表达式中的每行末尾添加注释?我有这样的代码:Vbscript 如何在ASP中的多行表达式中向每行末尾添加注释?,vbscript,asp-classic,Vbscript,Asp Classic,在ASP(使用VBScript)中,有没有办法在较长的多行表达式中的每行末尾添加注释?我有这样的代码: Dim qbsr As New QueryBuilder(conn) qbsr.Select = "Items.ItemCode as ItemCode,Items.Description as Descr, " & _ "Items.Class_03 as UnitType, " & _ ' ** Cannot add comment here *
Dim qbsr As New QueryBuilder(conn)
qbsr.Select = "Items.ItemCode as ItemCode,Items.Description as Descr, " & _
"Items.Class_03 as UnitType, " & _ ' ** Cannot add comment here **
"Items.Class_04 as UnitPlc, " & _ ' ** Cannot add comment here **
"Items.Class_05 as UnitArea" ' Comment here works fine
我发现,所有答案都是关于多行注释,而不是在多行表达式的每行末尾添加注释。
不,不幸的是,您不能在每行的末尾添加注释,只有最后一行。
< P>不能在代码的逻辑行中添加注释,即使您在屏幕上将其拆分为多个物理行。如果你绝对必须在中间有注释,那么你需要把代码本身分解成块。q = "Items.ItemCode as ItemCode, Items.Description as Descr, " '- comment goes here
q = q & "Items.Class_03 as UnitType, " '- comment goes here
q = q & "Items.Class_04 as UnitPlc, " '- comment goes here
q = q & "Items.Class_05 as UnitArea" '- comment goes here
qbsr.Select = q
(请注意,VBScript在字符串连接方面非常糟糕,因此这类代码可能非常慢-基本上,不要将其放入循环中。)谢谢,这对我帮助很大,这些查询不在循环中,所以我将它分成块,好主意:)