产品使用及交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

文章设为文章置顶就出错 [复制链接]

1#
设为文章置顶就出错,网站就直接打不开,请高手帮忙看看这个文章置顶模块的代码是哪里有问题?谢谢
<%
DataTable dt;
DataRow dr;
dt=Get_Data("select top 1 * from article where site_id="+Site_Id+" and sort_id in("+Sort_Ids+") and istop=1 order by thedate desc");
if(dt.Rows.Count>0)
{
%>
<div class="top_article">
<ul>

<%
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows;
%>
<li>
<%if(dr["titlepic"].ToString()!=""){%><img src="<%=dr["titlepic"]%>" border=0 style="<%=TitlePic_Size%>" class="pic"><%}%>
<p class="title">
<a href="<%=Detail_Url(dr)%>" target="<%=Target%>"><%=SubStr(dr["title"].ToString(),100,true)%></a></p>
<p class="introduct"><a href="<%=Detail_Url(dr)%>" target="<%=Target%>"><%=SubStr(dr["pa_introduct"].ToString(),250,true)%></a></p>
<p class="chear"></p>
</li>
<%
}
%>
</ul>
</div>
<%
}
%>

<div class="article">
<ul>
<%
dt=Get_Data();
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows;
%>
<li><span class="title">
<a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
<span class="date"><%=((DateTime)dr["thedate"]).ToString("MM-dd")%></span>
<span class="clear"></span>
</li>
<%
}
%>
</ul></div>
分享 转发
TOP
2#

应该是对应分类下没有子分类,导致Sort_Ids为空所以导致语法错误,最好的就判断一下Sort_Ids是否为空,如果为空就删除sort_id in("+Sort_Ids+") and 这段,非空就保留
TOP
3#

ok了,版主威武!
TOP
发新话题 回复该主题