六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

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

這是asp.net的第二個應用(4)

[摘要]http://www.asp888.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" >
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link rel="stylesheet" type="text/css" href="/doufu.css">
</head>
<body>
<!--廣告開始-->
<img src="http://edu.chinaz.com/Get/Program/Net/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" >
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link rel="stylesheet" type="text/css" href="/doufu.css">
</head>
<body>
<!--廣告開始-->
<img src="http://edu.chinaz.com/Get/Program/Net/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+,我們才說,他真牛!





主站蜘蛛池模板: 最近免费观看高清韩国日本大全 | 在线岛国片 | 亚洲欧美在线观看一区二区 | 五月婷婷六月爱 | 欧美一区二区三区美人 | 无声在线完整版免费观看 | 五月天第一页 | 中国黄色毛片 | 永久国产| 亚洲综合狠狠 | 青青青国产免费 | 婷婷六月久久综合丁香乐透 | 亚洲欧美日本在线观看 | 天干天干天啪啪夜爽爽色 | 亚洲视频一区在线播放 | 一二三四日本高清观看视频 | 亚欧成人中文字幕一区 | 日本亚洲欧美美色 | 亚洲1区2区3区4区 | 青青青国产色视频在线观看 | 青青草精品在线视频 | 一a一级片| 亚洲我不卡 | 香蕉免费一级视频在线观看 | 日本韩国在线视频 | 婷婷丁香六月天 | 日韩欧美国产成人 | 四川农村女人一级毛片 | 欧美一级黄色片免费看 | 色综合伊人色综合网站中国 | 日本高清视频色 | 无遮挡毛片a级武则天 | 四虎新网站 | 日日干日日摸 | 亚洲人成在线播放网站 | 色av.com| 色综合久久一本首久久 | 欧美爽爽爽爽爽爽视频 | 中文字幕第一页在线播放 | 四虎影院紧急入口 | 啪啪动漫 |