<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from b1 order by id desc ",conn%> <%Do Until rs.eof%><%=rs("username")%><%=rs("mail")%><%rs.movenext
loop
rs.close
conn.close
set rs=nothing
set conn=nothing
%> 当username,mail其中一个字段为空,就不能正常显示了.请问高手怎么解决?在本代码上怎么改?
å¨sqlè¯å¥ä¸å¤æusernameåmailçå¼æ¯å¦ä¸ºç©ºï¼ä¸ºç©ºçå°±ä¸è¯»å»ä»ï¼ä»£ç å¦ä¸set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from b1 where username<>"" and mail<>"" order by id desc ",conn,1,1
Do Until rs.eof
response.write(rs("username"))
response.Write(rs("mail"))
rs.movenext
loop
rs.close
conn.close
rs.Open "select * from b1 where username<>"" and mail<>"" order by id desc ",conn,1,1
Do Until rs.eof
response.write(rs("username"))
response.Write(rs("mail"))
rs.movenext
loop
rs.close
conn.close
温馨提示:答案为网友推荐,仅供参考
第1个回答 2013-07-19
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from b1 order by id desc ",connDo while not rs.eof%><%=rs("username")%><%=rs("mail")%><%rs.movenext
loop
rs.close
conn.close
set rs=nothing
set conn=nothing
%> 字段为空的话 你可以做个判断 显示为别的
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from b1 order by id desc ",connDo while not rs.eof%><%=rs("username")%><%=rs("mail")%><%rs.movenext
loop
rs.close
conn.close
set rs=nothing
set conn=nothing
%> 字段为空的话 你可以做个判断 显示为别的
第2个回答 2013-07-19
加入if判断记录集是否为空 如下:rs.Open "select * from b1 order by id desc ",connif rs.eof thenresponse.write “赞无记录"elseDo Until rs.eof%><%=rs("username")%><%=rs("mail")%><%rs.movenext
loopend if
rs.close
conn.close
set rs=nothing
set conn=nothing
loopend if
rs.close
conn.close
set rs=nothing
set conn=nothing
第3个回答 2013-07-19
怎么个不正常法?截个图看看呀。