一个烦人的ASP问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 03:48:50
我在改一个ASP程序 在这段代码出现了问题 实在不明白 还得请教高手帮解答了 先看代码:

<%set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 8 * from chanpin where newid=1 order by id desc",conn,1,1
if rs.eof and rs.bof then
response.write "<td align=center><font color=red size=2>对不起,暂无新品!</font></td>"
else%>
<%
if not rs.eof then
i=1
do while not rs.eof%>
<td align="center" valign="middle">
<%if rs("xiaopic")="" then %> ------问题出在这……
<a href=cd.asp?id=<%=rs("id")%> target="_blank">
<img src="cdpic/nopic.gif" width="68" height="68" hspace="0" vspace="0" border="1" title=" ⊙ 唱片名:<%=rs("zhuanji")%>
★ 艺人:<%=rs("yiren")%>
¥ 仅售:<%=rs("jiage")%> 元"></a>

这是一个常见问题咯~~
可以这么解决哈
if (rs("xiaopic")&"")="" ...
或者,if cstr(rs(..))="" ..<-这个是我刚想到的,强制类型转换,不知道报不报错~~

这是一个常见问题咯~~
可以这么解决哈
if (rs("xiaopic")&"")="" ...
或者,if cstr(rs(..))="" ..<-这个是我刚想到的,强制类型转换,不知道报不报错~~ 具体原因不好说
如果你连的是SQL数据库
也许是NULL值的原因
你这样试试
if rs("xiaopic")="" or isnull(rs("xiaopic")) then
具体原因不好说
如果你连的是SQL数据库
也许是NULL值的原因
你这样试试
if rs("xiaopic")="" or isnull(rs("xiaopic")) then
具体原因不好说
如果你连的是SQL数据库
也许是NULL值的原因
你这样试试
if rs("xiaopic")="" or isnull(rs("xiaopic")) then

具体原因不好说
如果你连的是SQL数据库
也许是NULL值的原因
你这样试试
if rs("xiaopic")="" or isnull(rs("xiaopic")) then

rs("xiaopic")应该是个图片类型,但是你把它和空字符相比,不正确.我觉得应该用二进制串的判断函数来
判断它是否为空