asp中sql数据库if条件条件显示 20
asp显示数据库每条数据,其实有个字段是存放附件名,若该字段为空,则附件的图标不显示,但其他字段仍正常显示,现在就是不知道if条件语句该怎么添加,总是报错说语法错误。源代...
asp显示数据库每条数据,其实有个字段是存放附件名,若该字段为空,则附件的图标不显示,但其他字段仍正常显示,现在就是不知道if条件语句该怎么添加,总是报错说语法错误。源代码如下,求高手。由于字数限制,代码略有删减。
......
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" >
......
<tr align="center">
<td bgcolor="#F2FDFF" width="6%"><span class="STYLE1">aa</span></td>
<td bgcolor="#F2FDFF" width="8%"><span class="STYLE1">bb</span></td>
<td bgcolor="#F2FDFF" width="16%"><span class="STYLE1">cc</span></td>
<td bgcolor="#F2FDFF" width="27%"><span class="STYLE1">dd</span></td>
<td bgcolor="#F2FDFF" width="20%"><span class="STYLE1">ee</span></td>
<td bgcolor="#F2FDFF" width="3%"><span class="STYLE1">ff</span></td>
...
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %> <tr>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("a").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("b").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("c").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("d").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("e").Value)%></td>
<td><div align="center">
(应该是加在这吧?)
<A HREF="download.asp?fj=<%=(Recordset1.Fields.Item("fj").Value)%>">
<img src="images/download.gif" width="22" height="22" border="0"></A></div></td>
</tr>
<%Repeat1__index++;
Recordset1.MoveNext()}
%>
</table>
<%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<%
Recordset1.Close();
%> 展开
......
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" >
......
<tr align="center">
<td bgcolor="#F2FDFF" width="6%"><span class="STYLE1">aa</span></td>
<td bgcolor="#F2FDFF" width="8%"><span class="STYLE1">bb</span></td>
<td bgcolor="#F2FDFF" width="16%"><span class="STYLE1">cc</span></td>
<td bgcolor="#F2FDFF" width="27%"><span class="STYLE1">dd</span></td>
<td bgcolor="#F2FDFF" width="20%"><span class="STYLE1">ee</span></td>
<td bgcolor="#F2FDFF" width="3%"><span class="STYLE1">ff</span></td>
...
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %> <tr>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("a").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("b").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("c").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("d").Value)%></td>
<td bgcolor="#ebf0f7"><span class="STYLE1"><%=(Recordset1.Fields.Item("e").Value)%></td>
<td><div align="center">
(应该是加在这吧?)
<A HREF="download.asp?fj=<%=(Recordset1.Fields.Item("fj").Value)%>">
<img src="images/download.gif" width="22" height="22" border="0"></A></div></td>
</tr>
<%Repeat1__index++;
Recordset1.MoveNext()}
%>
</table>
<%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<%
Recordset1.Close();
%> 展开
1个回答
展开全部
<% if Recordset1.Fields.Item("fj").Value<>"" & if Recordset1.Fields.Item("fj").Value<>null then %>
<A HREF="download.asp?fj=<%=(Recordset1.Fields.Item("fj").Value)%>"><img src="images/download.gif" width="22" height="22" border="0"></A>
<%else%> <%end if%>
<A HREF="download.asp?fj=<%=(Recordset1.Fields.Item("fj").Value)%>"><img src="images/download.gif" width="22" height="22" border="0"></A>
<%else%> <%end if%>
更多追问追答
追问
报语法错误
Microsoft JScript 编译错误 (0x800A03ED)
缺少 '('
追答
再试试这个
"" and Recordset1.Fields.Item("fj").Valuenull then %>
">
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |