/// <summary>
/// 取出前后新闻,产生连接,如果前后都有则占2行.
/// </summary>
/// <param name="articleid">目前记录id</param>
/// <returns></returns>
public string _4S_article_link(string articleid, string page)
{
StringBuilder str = new StringBuilder("");
con.SetDefaultConnection(constr);
string sql = "SELECT classname FROM db_article WHERE (articleid = @articleid)";
SqlParameter[] prams = new SqlParameter[1];
prams[0] = new SqlParameter("@articleid", articleid);
DataRow row = con.Row(sql, prams);
string classname = row["classname"].ToString();
sql = "SELECT TOP 1 articleid FROM db_article WHERE (articleid < @articleid) AND (classname = '" + classname + "') ORDER BY articleid DESC";
prams[0].ParameterName = "@articleid";
prams[0].Value = articleid;
row = con.Row(sql, prams);
if (row != null)
{
str.Append("<a href='"+page+"?id=" + classname.Substring(5) +"&articleid=");
str.Append(row["articleid"].ToString());
str.Append("'><span style='color: #000099'>上一条");
str.Append("</span></a>");
}
sql = "SELECT TOP 1 articleid FROM db_article WHERE (articleid > @articleid) AND (classname = '" + classname + "') ORDER BY articleid";
row = con.Row(sql, prams);
if (row != null)
{
str.Append(" <a href='"+page+"?id=" + classname.Substring(5) + "&articleid=");
str.Append(row["articleid"].ToString());
str.Append("'><span style='color: #000099'>下一条");
str.Append("</span></a> ");
}
else
str.Append(" ");
return str.ToString();
}