日期:2014-05-16  浏览次数:20753 次

求大神加个 if 语句
本帖最后由 awp5478 于 2013-08-14 15:11:49 编辑
<%
dim str,sp
set rs=conn.execute("select * from light where id="&request("id"))
str=rs("picname")
sp=split(str,",")
%>
<%for i=0 to ubound(sp)%>
<table align="center">
<tr>
<td>
<img src="http://img.baidu.com/ke/<%=sp(i)%>" border="0" width="700"><p>
</td>
</tr>
</table>
<%next%>

正常情况运行上面的,否则就是下面的代码,怎么在上面加 if 语句

<%else%>
没有文件
<%end if%>

------解决方案--------------------
引用:
Quote: 引用:

Response.write rs("picname")

瞧瞧有值吗


有值的是正确的,空值的时候跳错,我想弄空值的不显示就可以了

   str=rs("picname")
   if str<> "" then
       sp=split(str,",")
   else
       sp=null
   end if
   if IsArray(sp) then