<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      一個技巧完善的專欄管理的程序->這是asp.net的第二個應用(4)

      [摘要]一個功能完善的專欄管理的程序->這是asp.net的第二個應用(四)/*豆腐制作,都是精品http://www.asp888.net 豆腐技術站如轉載,請保留完整版權信息*/我們首先來按照欄目...
      一個功能完善的專欄管理的程序->這是asp.net的第二個應用(四)
      /*
      豆腐制作,都是精品
      http://www.asp888.net 豆腐技術站
      如轉載,請保留完整版權信息
      */
      我們首先來按照欄目的類別來顯示欄目的所有文章,當然一個分頁的程序是非常關鍵的,我們還是來用我們在 留言版 中用到的 那個分頁的程序,過幾天 我會把這個作成一個pagelet 的,大家趕快鼓勵我吧!

      showarticle.aspx:
      <!--#include file="func.aspx"-->
      <html>
      <head>
      <title>瀏覽文章</title>
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      <meta name="Description" Content="探討ASp,Php 編程,介紹Visual Basic ,Visual C++
      等業界最新技術 并提供 免費的各種服務 包括 免費統計系統,免費調查
      并提供 招聘站點和 同學錄 的服務">
      <meta name="Keywords" Content="探討ASp,Php 編程,介紹Visual Basic ,Visual C++
      等業界最新技術 并提供 免費的各種服務 包括 免費統計系統,免費調查
      并提供 招聘站點和 同學錄 的服務">
      <link REL="SHORTCUT ICON" href="http://www.asp888.net/site.ico">
      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
      <link rel="stylesheet" type="text/css" href="/doufu.css">
      </head>
      <body>
      <!--廣告開始-->
      <img src=http://www.okasp.com/techinfo/"images/banner.gif">
      <!--廣告結束-->
      <%
      dim strClassid as string
      dim conn as SQLConnection
      dim sqlCmd as SQLCommand
      dim sqlRead as SQLDataReader
      dim strSQL as string
      dim intLen as integer
      dim intRecCount as integer

      strClassid=request.querystring("classid")
      conn=GetConn()
      strSQL="select count(*) from lanmu where classid=" & strClassid & ""
      sqlCmd=new SQLCommand(strSQL,conn)
      sqlCmd.ActiveConnection.Open()
      sqlCmd.Execute(sqlRead)
      sqlCmd.ActiveConnection.Close()
      sqlRead.Read()
      if cInt(sqlRead(0))=0 then
      response.write("對不起,當前這個欄目沒有內容")
      response.end
      end if
      intRecCount=sqlRead(0)
      strSQL="select * from lanmu,lanmuclass where lanmu.classid=lanmuclass.classid and lanmu.classid=" & strClassID & " and lanmu.isuse='1' order by id desc"
      sqlCmd=new SQLCommand(strSQL,conn)
      sqlCmd.ActiveConnection.Open()
      sqlCmd.Execute(sqlRead)


      '處理分頁顯示

      dim intPageCount as integer
      dim intStart as integer

      if isNumeric(request.querystring("start")) then
      intStart=Cint(request.querystring("start")) '本頁數據起使位置
      else
      intStart=0
      end if

      intLen=10 '每頁需要顯示的數據數量
      '以下計算 當前的 記錄的分頁頁數
      if (intRecCount mod intLen)=0 then
      intPageCount=intRecCount/intLen
      else
      intPageCount=(intRecCount-(intRecCount mod intLen))/intLen+1
      end if
      dim i as integer
      '將得到的sqlRead向后移動 start 指定的 位置
      for i=0 to intStart-1
      sqlRead.read()
      next
      '顯示table 分頁Bar
      WritePage(intStart,"showarticle.aspx",intLen ,intPageCount ,intRecCount )
      %>
      <table border=1 width=100%>
      <tr>
      <td width=10% align=center>編號</td>
      <td width=50% nowrap>主題</td>
      <td width=25% align=center>作者</td>
      <td width=25% align=center>閱讀次數</td>
      </tr>
      <%
      for i=0 to intLen-1
      atEnd=sqlRead.read()
      if not atEnd then exit for%>
      <tr>
      <td align=center><%=sqlRead("id")%></td>
      <td><a href="viewArticle.aspx?id=<%=sqlRead("id")%>"><%=sqlRead("title")%></a></td>
      <td align=center><%=sqlRead("userid")%></td>
      <td align=center><%=sqlRead("viewnum")%></td>
      </tr>
      <%next%>
      </table>
      <p></p>
      </body>
      </html>
      這個程序沒有什么說的,我們看看就可以了。如果有什么看不懂的地方,別著急,再看看下面的這個程序:)
      viewarticle.aspx 文件是用來查看具體的某一篇文章的,因為時間的關系,我沒有把這個程序的評論和打分的
      功能添加上,哎!我也很傷心,等到以后吧!
      viewarticle.aspx
      <!--#include file="func.aspx"-->
      <%

      dim conn as SQLCOnnection
      dim sqlRead as SQLDataReader
      dim sqlCmd as SQLCommand
      dim strSQL as string
      dim strID as string
      conn=getConn()
      strID=request.querystring("id")
      strSQL="select * from lanmu,lanmuclass where lanmu.classid=lanmuclass.classid and lanmu.id=" & strID & ""
      sqlCmd=new SQLCommand(strSQL,conn)
      sqlCmd.ActiveConnection.Open()
      sqlCmd.Execute(sqlRead)
      if not sqlRead.Read() then
      '沒有留言信息
      echoErr("對不起,當前這個欄目還沒有內容")
      end if
      %>
      <html>
      <head>
      <title>瀏覽文章__技術專欄__<%=sqlRead("title")%></title>
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      <meta name="Description" Content="探討ASp,Php 編程,介紹Visual Basic ,Visual C++
      等業界最新技術 并提供 免費的各種服務 包括 免費統計系統,免費調查
      并提供 招聘站點和 同學錄 的服務">
      <meta name="Keywords" Content="探討ASp,Php 編程,介紹Visual Basic ,Visual C++
      等業界最新技術 并提供 免費的各種服務 包括 免費統計系統,免費調查
      并提供 招聘站點和 同學錄 的服務">
      <link REL="SHORTCUT ICON" href="http://www.asp888.net/site.ico">
      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
      <link rel="stylesheet" type="text/css" href="/doufu.css">
      </head>
      <body>
      <!--廣告開始-->
      <img src=http://www.okasp.com/techinfo/"images/banner.gif">
      <!--廣告結束-->

      <p>當前所在位置--<a href="/">豆腐技術站</a>__<a href="/lanmu">技術專欄</a>__<a href="showArticle.asp?classid=<%=sqlRead("Classid")%>"><%=sqlRead("classname")%></a></font></p>
      <center><font color=gray>這篇文章已經被閱讀</font><font color=red><%=sqlRead("viewnum")+1%></font><font color=gray>次</font></center>
      <p><%=replace((server.HTMLEncode(sqlRead("content"))),chr(13),"<br>")%></p>
      <table width=100%>
      <tr>
      <td width=100% align=right>作者:<%=sqlRead("userid")%>(<%=sqlRead("selFrom")%>)</td>
      </tr>
      <tr>
      <td width=100% align=right>添加時間:<%=sqlRead("dtime")%></td>
      </tr>
      </table>
      <p>
      </body>
      </html>
      <%response.end%>

      <script language="VB" runat=server>
      sub EchoErr(strErr as string)
      response.write("<html>")
      response.write("<head>")
      response.write("<title>瀏覽文章</title>")
      response.write(grabPage("/inc/head.inc"))
      response.write("<link rel='stylesheet' type='text/css' href='/doufu.css'>")
      response.write("</head>")
      response.write("<body>")
      response.write(strErr)
      response.write("</body></html>")
      response.end
      end sub
      </script>
      哎,純粹的 asp 代碼,我都有些忍不住了,但是的確是 這樣,asp.net 對于初學者來說,他的門檻并不高,我會在 以后不長的時間,等到大家都已經認為已經入門以后,推出這個系列文章的下一個版本,那個時候將使用純粹的asp.net 的代碼,不過話又 說回來,用什么方法不重要,只不過是我們對自己的要求而已,asp.net正是因為他可以使 asp 的程序員 很輕松的升級到asp+,我們才說,他真牛!




      日韩精品一区二区三区高清