常见问题 教学软件的常见问题>>

首页最新文章内如何显示:栏目+日.月 的形式?

发布时间:2010-11-24 13:42:30

答案:

sub ShowNewArticle(ArticleNum,TitleLen)
  dim sqlNew,rsNew
  if ArticleNum>0 and ArticleNum<=100 then
   sqlNew="select top " & ArticleNum
  else
   sqlNew="select top 10 "
  end if
  sqlNew=sqlNew & " A.ArticleID,A.Title,A.Author,A.UpdateTime,A.Hits,A.ClassID,L.LayoutFileName from article A inner join Layout L on L.LayoutID=A.LayoutID where A.Deleted=False and A.Passed=True order by A.articleid desc"
  Set rsNew= Server.CreateObject("ADODB.Recordset")
  rsNew.open sqlNew,conn,1,1
  if TitleLen<0 or TitleLen>255 then TitleLen=50
  if rsNew.bof and rsNew.eof then
   response.write "<li>没有文章</li>"
  else
   do while not rsNew.eof  
    response.Write "<li><a href='Article_Class2.asp?ClassID="&rsNew("ClassID")&"'><font color=#4474A3>[" & conn.execute("select * from ArticleClass where ClassID = "& rsNew("ClassID"))("ClassName") & "]</font></a>  <a href='" & rsNew("LayoutFileName") & "?ArticleID=" & rsNew("articleid") &"' title='文章标题:" & rsNew("Title") & vbcrlf & "作    者:" & rsNew("Author") & vbcrlf & "更新时间:" & month(rsnew("updateTime")) & "-" & day(rsnew("updateTime")) & vbcrlf & "点击次数:" & rsNew("Hits") & "' target='_blank'>" & gotTopic(rsNew("title"),TitleLen) & "</a>[<font color=red>" & month(rsnew("updateTime")) & "-" & day(rsnew("updateTime")) & "</font>]</li>"
          rsNew.movenext    
   loop
  end if 
  rsNew.close
  set rsNew=nothing
end sub

本FAQ适用范围

下一步您可以:
查看教学软件产品 >>