注册 登录
编程论坛 ASP技术论坛

do while循环如何跳过空值

javaxingxing 发布于 2010-01-29 19:20, 934 次点击
就是查询出来  循环的时候
sql=select class from productclass order by id desc
rs.open sql,conn,1,1

do while not rs.eof

<%=rs("class")%>

rs.movenext
loop


数据库表是
只有本站会员才能查看附件,请 登录

这里的class里面有空值,如何跳过呢……
3 回复
#2
风吹过b2010-01-29 20:25
<%
sql=select class from productclass order by id desc
rs.open sql,conn,1,1

do while not rs.eof
%>
<%if rs("class")<>"" then %>

<%=rs("class")%>

<%end if
rs.movenext
loop
%>
#3
hmhz2010-01-30 08:30
sql="select class from productclass where class<>'' or class is not null order by id desc"
#4
javaxingxing2010-01-30 10:00
2楼   楼主好像拉掉了点东西

if rs("class")<>""  then

……

else
rs.movenext
end if

这样就好使了……
不过相对3楼那个来说,3楼的更简单一些,谢谢你们了 ,我该自己好好想想,再过来提问,
主要是时间太紧了……
1