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

明輝手游網(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 平臺





主站蜘蛛池模板: 欧美亚洲另类综合 | 亚洲女人国产香蕉久久精品 | 日本在线看免费 | 日韩三级免费看 | 在线小视频国产 | 日韩中文字幕免费 | 午夜性视频 | 日本欧美一区二区三区视频 | 青青青青青在线视频播放 | 欧美特黄一级视频 | 日本高清视频在线观看 | 色老头久久久久久久久久 | 热re久久精品国产99热 | 欧美一区二区三区激情啪啪 | 无人码一区二区三区视频 | 亚洲欧美一区二区三区在线观看 | 五月在线视频 | 天天射视频 | 午夜影院免费版 | 色婷婷在线视频观看 | 亚洲精品国产综合久久一线 | 午夜激情视频专区在线观看网站大全 | 日韩黄色大片免费看 | 日本视频a | 最新国语露脸精品国产 | 亚洲日韩精品欧美一区二区一 | 人人狠狠| 综合丁香| 亚洲五月七月丁香缴情 | 伊人久久网站 | 在线视频一二三区 | 日韩精品在线观看免费 | 天天草夜夜草 | 日韩中文在线 | 日日摸日日添日日透 | 日韩久久免费视频 | 午夜爱爱爱爱爽爽爽网站免费 | 亚洲男人的天堂在线视频 | 在线免费色| 永久免费毛片 | 日韩高清性爽一级毛片免费 |