asp.net'如果'操作员需要两个或三个操作数
问题描述:
我已经写了一些代码来找出3个变量女巫是最低的然后显示它,但我得到''如果'操作符需要两个或三个操作数。 “我不确定这个问题是什么帮助将不胜感激。asp.net'如果'操作员需要两个或三个操作数
<%
dim HP_RegularPayment As Integer = HP_RegularPayment
dim LPC_RegularPayment As Integer = LPC_RegularPayment
dim PCP_RegularPayment As Integer = PCP_RegularPayment
if HP_RegularPayment < LPC_RegularPayment and if HP_RegularPayment < PCP_RegularPayment then
%>
<div id="detailsprice" style="height:70px; padding-top:5px;">
£<% if DiscountPrice.Text = "" then
Response.Write(DiscountPrice.Text)
else
Response.Write(Price.Text)
end if
%><br /> <span style="font-size:12px;">Or £<%Response.Write(HP_RegularPayment) %> Per Month With HP Finance</span> </div> <%
else if LPC_RegularPayment < HP_RegularPayment and if LPC_RegularPayment < PCP_RegularPayment then
%>
<div id="detailsprice" style="height:70px; padding-top:5px;">
£<% if DiscountPrice.Text = "" then
Response.Write(DiscountPrice.Text)
else
Response.Write(Price.Text)
end if
%><br /> <span style="font-size:12px;">Or £<%Response.Write(LPC_RegularPayment) %>
Per Month With LP Finance</span> </div> <%
else if PCP_RegularPayment < HP_RegularPayment and if PCP_RegularPayment < LPC_RegularPayment then
%>
<div id="detailsprice" style="height:70px; padding-top:5px;">
£<% if DiscountPrice.Text = "" then
Response.Write(DiscountPrice.Text)
else
Response.Write(Price.Text)
end if
%><br /> <span style="font-size:12px;">Or £<%Response.Write(PCP_RegularPayment) %> Per Month With PCP Finance</span> </div> <%
else%>
<div id="detailsprice">
£<% if DiscountPrice.Text = "" then
Response.Write(DiscountPrice.Text)
else
Response.Write(Price.Text)
end if
end if%>
感谢刘易斯
答
这是因为你已经有了另一if
内每个现有if
语句...
if HP_RegularPayment < LPC_RegularPayment and **if** HP_RegularPayment < PCP_RegularPayment then
VB.NET has an operator称为If
,它有两个或三个参数,以及如果所述第一是Nothing
,将其返回第二个参数。
删除它,这使该行...
if HP_RegularPayment < LPC_RegularPayment and HP_RegularPayment < PCP_RegularPayment then
我也将与@IrishChieftain在他的评论表示赞同,那你真的应该分开你的代码和标记。
答
,而不是
if HP_RegularPayment < LPC_RegularPayment and if HP_RegularPayment < PCP_RegularPayment then
使用
if HP_RegularPayment < LPC_RegularPayment and HP_RegularPayment < PCP_RegularPayment then
您需要将您的代码与标记分开。 – IrishChieftain
你的权利,我应该但我没有时间让代码优势这只是一个quck和肮脏的构建。 –