asp 中if语句
来源:百度知道 编辑:UC知道 时间:2024/05/12 07:35:07
<%if session ("username")="" then%>
<!--#include file="fwqlb.asp"-->
<%else%>
<%
set rs=server.createobject("adodb.recordset")
sql="select Flag from Dv_User where UserName='"& session("username") &"'"
rs.open sql,conn,1,1
%>
<%
if rs("Flag")="2" then
%>
<!--#include file="ServerDPrice.asp"-->
<%
elseif rs("Flag")="3" then %>
<!--#include file="fwqlb.asp"-->
<%
else
%>
<!--#include file="DLPrice.asp"-->
<%end if%>
<%end if%>
<%if request.QueryString("action")="" then%>
<!--#include file="fwqlb.asp"-->
<%end i
<!--#include file="fwqlb.asp"-->
<%else%>
<%
set rs=server.createobject("adodb.recordset")
sql="select Flag from Dv_User where UserName='"& session("username") &"'"
rs.open sql,conn,1,1
%>
<%
if rs("Flag")="2" then
%>
<!--#include file="ServerDPrice.asp"-->
<%
elseif rs("Flag")="3" then %>
<!--#include file="fwqlb.asp"-->
<%
else
%>
<!--#include file="DLPrice.asp"-->
<%end if%>
<%end if%>
<%if request.QueryString("action")="" then%>
<!--#include file="fwqlb.asp"-->
<%end i
出现这样的情况,可能问题出在包含文件中
我觉得你可以换一种方式,不要用包含文件来做,用函数
举个例子:
<%
if session ("username")="" then
call fwqlb()
else
call other()
end if
%>
<%
sub fwqlb()
............
end sub
sub other()
............
end sub
%>
我觉得这样就比较清楚,也容易修改,个人建议~~
<!--#include file="$$$$$"--> 是不受条件限制的。。方法支持楼上
注意
<!--#include file=""-->
的执行顺序
IIS会在解释程序之前就读取包涵文件
回答者:bdtest 说得对。
<!--#include file=""--> 里面的所有包含文件都会被先执行。然后才会执行if 之类的