ASP中的嵌套IF语句。代码有什么问题?

时间:2009-08-07 01:09:22

标签: asp-classic

我确实有几行代码由嵌套的IF语句组成。但它有一个错误..我不知道怎么弄清楚..希望你们中的任何人都可以帮助我解决这个问题..代码如下..

<%

If rs.Fields.Item("StudentStatus").Value="" 
  If (rs.Fields.Item("CGPAOverall").Value>="2.00") Then %>
<strong><font color="#3300FF" size="-1" face="Arial, Helvetica, sans-serif">
You are QUALIFIED to go for competition
</font></strong>

<% Else %>

<strong><font color="#FF0000" size="-1" face="Arial, Helvetica, sans-serif">
You are NOT QUALIFIED to go for competition
</font></strong>

<%Else
If rs.Fields.Item("StudentStatus").Value="YES" then
response.write "APPROVED"
else
response.write "NOT APPROVED"

end if

End if

End If
%> 

但是当我编译代码时,错误就是这个..

Error Type:
Microsoft VBScript compilation (0x800A03F9)
Expected 'Then'
/project2/check_status.asp, line 109, column 50
If rs.Fields.Item("StudentStatus").Value=""
-------------------------------------------------^

需要你的建议如何纠正这个错误..请帮助..谢谢..

2 个答案:

答案 0 :(得分:4)

IF RS.Fields("StudentStatus").Value="" Then
    IF rs.Fields.Item("fieldname").Value>=2.00 Then
           ....
    End if
Else If ....
    ....
Else
    ....
End IF  

答案 1 :(得分:1)

错误消息包含您要查找的答案:

Expected 'Then'

将'then'添加到预期位置:/project2/check_status.asp, line 109, column 50

之后我会建议阅读Read error messages, understand them and write your own