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

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

asp+版本容易的留言板的制作(3)

[摘要]http://www.asp888.net 豆腐技術站 現(xiàn)在該顯示了,其實顯示是很簡單,只要看過豆腐前面文章的朋友應該都知道該怎么寫這個程序,但是我在這里要強調(diào)的是 分頁 的程序,我也和大家 一樣,...
http://www.asp888.net 豆腐技術站

現(xiàn)在該顯示了,其實顯示是很簡單,只要看過豆腐前面文章的朋友應該都知道該怎么寫這個
程序,但是我在這里要強調(diào)的是 分頁 的程序,我也和大家 一樣,在開始的時候,想利用web form
的數(shù)據(jù)綁定的功能,但是不幸的是,雖然用datagrid 實現(xiàn)綁定和分頁都是很簡單的,但是 datagrid
顯然形式上的Grid顯然對 留言版 這樣的程序是 不適合的,DBList 到是可以適合留言版的程序形式
但是 我查找了很長的時間 都沒有找到如何去 實現(xiàn)分頁的程序
后來在 MSDN 上找到了 PagedDataSource 看看他的 Class Member 我都心驚肉跳,所有的我要的分頁
的功能他都已經(jīng)提供了,但是我在調(diào)試的過程中,卻怎么也 無法通過,估計是和我的 PDC 版本的原因,
這個時候,我就想起了 開心(注:網(wǎng)友名稱,他曾經(jīng)建議我直接安裝NGWS beta1 和 Vs7 beta1):)

希望大家如果在 Beta1 上調(diào)試成功了以后,一定要告訴豆腐

沒有別的辦法,我只好就去用我的老辦法,用程序去控制,老天,我不想這樣,但是我真的沒有別的
辦法了

大家請看程序:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Data.SQL" %>
<HTML><HEAD>
<script runat="server" language="VB">
dim sqlRead as SQLDataReader
dim intStart as integer
dim intLen as integer
dim intPageCount as integer
dim intRecCount as integer
Sub Page_Load(Src As Object, E As EventArgs)
Dim conn As SQLConnection
Dim Cfg as HashTable
Dim sqlcmd As SQLCommand

Cfg = Context.GetConfig("appsettings")
Conn = New SQLConnection(cfg("Conn"))

dim strSQL as string
'實在是沒有辦法,只好這樣來獲得 記錄總數(shù)了
'根據(jù)NGWS的幫助上看 似乎有個PagedDataSource 好象功能挺強大
'但是 就是 不知道 應該怎么使用 也沒有見過 用他的例子
strSQL="select count(*) as ccount from msgBoard"
sqlcmd = New SQLCommand(strSQL,conn)
sqlcmd.ActiveConnection.Open()
sqlcmd.execute(sqlRead)
sqlRead.Read()
intRecCount=cInt(sqlRead("ccount"))
sqlcmd.ActiveConnection.Close()
strSQL="select * from msgBoard order by msgid desc"
sqlcmd = New SQLCommand(strSQL,conn)
sqlcmd.ActiveConnection.Open()
sqlcmd.execute(sqlRead)


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

intLen=10 '每頁需要顯示的數(shù)據(jù)數(shù)量
'以下計算 當前的 記錄的分頁頁數(shù)
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
end sub
sub WritePage(start as integer,file as string)
'進行分頁處理
dim strWrite as string
strWrite="<table border=1 width=100%><tr><td>"
response.write(strWrite)

if start=0 then
strWrite="首頁"
else
strWrite="<a href='" & file & "?start=0'>首頁</a>"
end if
response.write(strWrite)

if start>=1 then
strWrite="<a href='" & file & "?start=" & cStr(start-intLen) & "'>上頁</a>"
else
strWrite="上頁"
end if
response.write(strWrite)

if start+intLen<intRecCount then
'還沒有到最后一頁數(shù)據(jù)
strWrite="<a href='" & file & "?start=" & cStr(start+intLen) & "'>下頁</a>"
else
strWrite="下頁"
end if
response.write(strWrite)

if start+intLen<intRecCount then
'還沒有到最后一頁數(shù)據(jù)
strWrite="<a href='" & file & "?start=" & cStr((intPageCount-1)*intLen) & "'>末頁</a>"
else
strWrite="末頁"
end if
response.write(strWrite & "</td><td>")

strWrite="當前共有留言" & Cstr(intRecCount) & ",現(xiàn)在是第<font color=red>" & cStr((intStart/intLen)+1) & "/" & cstr(intPageCount) & "</font>頁"
response.write(strWrite)
strWrite="</td></tr></table>"
response.write(strWrite)
end sub
</script>
<title>豆腐技術站__aspx分站__查看留言</title>
<link rel="stylesheet" type="text/css" href="/doufu.css">
</HEAD>
<BODY>
<a )
dim atEnd as boolean
%>
<% for i=0 to intLen-1%>
<%
atEnd=sqlRead.read()
if not atEnd then exit for
%>
<div align=center>
<table border=1 width=80%>
<tr>
<td width=10%>呢稱</td>
<td width=40%><%=sqlRead("nickname")%></td>
<td width=10%>IP地址</td>
<td width=10%><%=sqlRead("IPAddr")%></td>
</tr>
<tr>
<td width=10%>聯(lián)系方式</td>
<td width=90% colspan=3><%=sqlRead("email")%></td>
</tr>
<tr>
<td width=10%>留言主題</td>
<td width=90% colspan=3><%=sqlRead("msgTitle")%>----<font color=red><%=sqlRead("msgTime")%></font></td>
</tr>
<tr>
<td width=10%>留言內(nèi)容</td>
<td width=90% colspan=3><%=server.HTMLEncode(sqlRead("msgContent"))%></td>
</tr>
</table>
</div>
<p></p>
<%next%>
</body>
</html>
終于完了:)

結束語:
在大家看過 三篇文章后,整個的留言版的程序也就已經(jīng)全部的講完了,客觀的說,通過這個程序
我們還無法完全的領略asp+給我們帶來的所有令人興奮的功能,而且還有很多的功能現(xiàn)在似乎還是在
宣傳的階段,但是 畢竟現(xiàn)在才是Beta1 的階段,相信在正式版本推出的時候,我們可以看到一個全新
的面向 Web 編程的 .net 平臺





主站蜘蛛池模板: 中文字幕一精品亚洲无线一区 | 手机在线看片国产日韩生活片 | 四虎aⅴ | 青青热久免费精品视频网站 | 四虎国产精品免费久久久 | 午夜性色福利视频 | 亚洲成a人片在线观看88 | 伊人精品久久久大香线蕉99 | 天天干2018| 探花视频免费观看高清 | 日韩精品一区二区三区中文字幕 | 亚洲国产成人久久综合区 | 午夜影院在线观看视频 | 日本视频www色变态 日本视频a | 午夜成人免费视频 | 欧美一区二区三区在线观看 | 一级毛片视频免费 | 日本不卡视频 | 日韩 欧美 国产 亚洲 制服 | 日韩不卡高清 | 亚洲国产天堂久久综合 | 在线视频你懂的国产福利 | 四虎a456tncom | 亚洲mm8成为人影院 亚洲h在线观看 | 日韩激情视频在线 | 色噜噜狠狠在爱丁香 | 青青热久久国产久精品 | 日韩黄色一级片 | 一级毛片免费视频 | 中文字幕视频一区 | 日韩美女一区 | 日本高清视频在线 | 青草久久影院 | 日本 欧美 在线 | 西西gogo午夜高清大胆 | 羞羞一区二区三区四区片 | 日日摸夜夜摸无需播放器 | 欧美一区二区三区在线可观看 | 色天天网 | 欧美亚洲国产人成aaa | 最新网址在线观看 |