回 帖 发 新 帖 刷新版面

主题:rootid为备注型数据,如果不想显示rst.rootid=21,是不是在哪个位置加上语句:“if

rootid为备注型数据,如果不想显示rst.rootid=21,是不是在哪个位置加上语句:“if rst.rootid="21" then not response.write tempcatastr”,但是我不知道具体位置啊,谢谢帮助!

        <%
        set rst=server.CreateObject("adodb.recordset")
        sqlt="Select * from newscata order by rootid"
        rst.Open sqlt,conn,1,3
  
            do while not rst.EOF
                tempcataStr="<tr valign=center align=middle bgcolor=#ffffff>"
                tempcataStr=tempcataStr&"<td onMouseOver=mOvr(this,'#ffffff'); onMouseOut=mOut(this,'#f5f5f5'); bgcolor=#f5f5f5 height=25>"
                tempcataStr=tempcataStr&"<div align=right><a href=default.asp?cataid="&trim(rst("id"))&">"&trim(rst("title"))&"</a> <img src='../images/pot_11.gif'>&nbsp;&nbsp;&nbsp;&nbsp;</div></td>"
                   tempcataStr=tempcataStr&"<tr>"
                  tempcataStr=tempcataStr&"<td bgcolor=#f5f5f5>"
                tempcataStr=tempcataStr&"<table cellspacing=0 cellpadding=0 width=80% align=center border=0>"
                  tempcataStr=tempcataStr&"<tbody>" 
                  tempcataStr=tempcataStr&"<tr> "
                tempcataStr=tempcataStr&"<td width='100%' background='../images/line_3.gif'  height=1></td>"
                  tempcataStr=tempcataStr&"</tr>"
                  tempcataStr=tempcataStr&"</tbody>" 
                tempcataStr=tempcataStr&"</table>"
                  tempcataStr=tempcataStr&"</td>"
                tempcataStr=tempcataStr&"</tr>"
                
                Response.Write tempcataStr
                rst.MoveNext
                            loop 
         rst.Close()
          set rst=nothing
        %>

回复列表 (共3个回复)

沙发

那你不如在sql语句这里就约束掉。
sqlt="Select * from newscata where rootid<>21 order by rootid"

板凳

如果用if语句应该怎么办呢?谢谢!

3 楼

sqlt="Select * from newscata order by rootid"
rs.open sqlt,conn,1,1
do while not rs.eof
 if rs("rootid")<>21 then
  '输出
 end if
loop

我来回复

您尚未登录,请登录后再回复。点此登录或注册