日期:2014-05-16 浏览次数:20535 次
public article_news GetNewsListTorD(string strWhere,string filedOrder)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 id,title from dt_article");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
if (filedOrder.Trim() != "")
{
strSql.Append(" order by " + filedOrder);
}
article_news ac = new article_news();
using (OleDbDataReader rs = DbHelperOleDb.ExecuteReader(strSql.ToString()))
{
if (rs.Read())
{
ac.id = (int)rs["id"];
if (rs["title"].ToString() != "")
{
ac.title = (string)rs["title"];
}
}
return ac;
}
}
<%csharp%>
DTcms.Model.article_news nModel=new DTcms.DAL.article().GetNewsListTorD("[id] <" + id + "and channel_id = " + channel_id + "", "id desc");
<%/csharp%>
<%if nModel!=null%>
<li>上一篇:<a href="<%linkurl("news_show",nModel.id)%>">{nModel.title}</a></li>
<%else%>
<li>上一篇:<a href="javascript:">没有了</a></li>
<%/if%>
<%csharp%>
DTcms.Model.article_news