??????? AbsolutePosition ????
????????????????????? RecordSet ?е?λ??????????? AbsolutePosition ?????
????AbsolutePosition ???????????????????????λ????? 1 ???????????? AbsolutePosition ? 1??
??????? ?? ???? RecordSet ????????? RecordSet ??ζ???????????????
??????????? AbsolutePosition?????????趨????????? cursor( ??? )?? asp ?????£?
????rs2.CursorLocation = 3
?????塢 PageCount ????
??????? PageCount ????????? Recordset ???????????“?”????????????“?”????????????????С???? PageSize ??????趨????????????????? PageSize ??????????????? PageCount ???????????????????????е?????????????????????
???????? PageSize ????
????PageSize ????????? ADO ???????????η?????????????????????????????????????????“??”???趨?????????????С???????????? AbsolutePage ?????????????????????????? PageSize ????????????趨??
??????? RecordCount ????
??????????????????ú?????????????????? RecordCount ???????????? Recordset ???????????????????磺 < % totle=RS.RecordCount %>
??????????? Recordset ???????????????????????????????£???????????????????????????????????????????? PageSize ??????????????????????????????????????????????;?????? RecordCount ??????????????????;???ü?????????? PageSize ??????????????????;????? AbsolutePage ?????????????????????????????????????????????????????????????????{?????????????}
?????????????????????? BBS ??ó?????????????з?????????????Σ?“ID”????????????????;“subject”??????????????;“name”???????????????; “email”????????????????;“postdate”????????????????? DSN ?“bbs”?????????????????????в????????????“ShowList()”??????У???????á????????£?
????'----BBS ?????????----
< % Sub ShowList() %>
< %
PgSz=20 '?趨???????????????????????????????20????
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
sql = "SELECT * FROM message order by ID DESC"
'?????????????????????ID????????
Conn.Open "bbs"
RS.open sql??Conn??1??1
If RS.RecordCount=0 then
response.write "< P>< center>?????????????????????!< /center>< /P>"
else
RS.PageSize = Cint(PgSz) '?趨PageSize??????
Total=INT(RS.recordcount / PgSz * -1)*-1 '????????????????
PageNo=Request("pageno")
if PageNo="" Then
PageNo = 1
else
PageNo=PageNo+1
PageNo=PageNo-1
end if
ScrollAction = Request("ScrollAction")
if ScrollAction = " ???? " Then
PageNo=PageNo-1
end if
if ScrollAction = " ???? " Then
PageNo=PageNo+1
end if
if PageNo < 1 Then
PageNo = 1
end if
n=1
RS.AbsolutePage = PageNo
Response.Write "< CENTER>"
position=RS.PageSize*PageNo
pagebegin=position-RS.PageSize+1
if position < RS.RecordCount then
pagend=position
else
pagend= RS.RecordCount
end if
Response.Write "< P>< font color='Navy'>< B>??????????:< /B>"
Response.Write "(????"&RS.RecordCount &"????????????????????"&pagebegin&"-"&pagend&")< /font>< /p>"
Response.Write "< TABLE WIDTH=600 BORDER=1 CELLPADDING=4 CELLSPACING=0 BGCOLOR=#FFFFFF>"
Response.Write "< TR BGCOLOR=#5FB5E2>< FONT SIZE=2>< TD>< B>????< /B>< /TD>< TD>< B>???< /B>< /TD>< TD>< B>Email< /B>< /TD>< TD>< B>????????< /B>< /TD>< /FONT>< TR BGCOLOR=#FFFFFF>"
Do while not (RS is nothing)
RowCount = RS.PageSize
Do While Not RS.EOF and rowcount >0
If n=1 then
Response.Write "< TR BGCOLOR=#FFFFFF>"
ELSE
Response.Write "< TR BGCOLOR=#EEEEEE>"
End If
n=1-n %>
< TD>< span style="font-size:9pt">< A href='view.asp?key=< % =RS("ID")%>'>< % =RS("subject")%>< /A>< /span>< /td>
< TD>< span style="font-size:9pt">< % =RS("name")%>< /A>< /span>< /td>
< TD>< span style="font-size:9pt">< a href="mailto:< % =RS("email")%>">< % =RS("email")%>< /a>< /span>< /TD>
< TD>< span style="font-size:9pt">< % =RS("postdate")%>< /span>< /td>
< /TR>
< %
RowCount = RowCount - 1
RS.MoveNext
Loop
set RS = RS.NextRecordSet
Loop
Conn.Close
set rs = nothing
set Conn = nothing
%>
< /TABLE>
< FORM METHOD=GET ACTION="list.asp">
< INPUT TYPE="HIDDEN" NAME="pageno" VALUE="< % =PageNo %>">
< %
if PageNo >1 Then
response.write "< INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' ???? '>"
end if
if RowCount = 0 and PageNo < >Total then
response.write "< INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' ???? '>"
end if
response.write "< /FORM>"
End if
%>
< % End Sub %>
?????????????????????????????????????????????????????????????????γ??????????????С????
????< INPUT TYPE="HIDDEN" NAME="pageno" VALUE="< % =PageNo %>">
??????????????????ε???? ASP ?????????????“????”?????????????????ε??ó?????????????????????????????????? session????????????????????????????????????????? form ???????????????????Ч????
???????????????????????????????????????????????е????????????????????? VbScript ????;