在以下情况下,我试图将“E”值移动到 BillMeType 变量,但它不起作用。
<% if TransactionGateway = "" then %>
<% BillMeType = "E" %>
<% end if %>
在以下情况下,我试图将“E”值移动到 BillMeType 变量,但它不起作用。
<% if TransactionGateway = "" then %>
<% BillMeType = "E" %>
<% end if %>
唯一BillMeType
不能设置为“E”的方法(使用您的代码示例)是如果TransactionGateway
不等于空字符串。TransactionGateway
可能看起来是一个空字符串 - 即NULL吗?
此外,如果您仍在代码块中,则无需进行所有上下文切换。您的代码可以重写为:
<%
If TransactionGateway = "" Then
BillMeType = "E"
End If
%>
恕我直言,这更具可读性。
另外,我编辑了你的标题。ASP.NET 和 ASP Classic 是两个完全不同的东西。“经典”一词源于此版本的 ASP 是 .NET 之前的版本。ASP Classic(通常)是用 VBScript 编写的,而 .NET 是用 CLR 语言(C#、VB.NET 等)编写的。一世
您可以使用
<% If TransactionGateway = ""
Then BillMeType = "E"
End If
cstr(BillMeType)
response.Write(BillMeType)%>