麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

用RecordSet實現(xiàn)分頁(by Daniel Adrian)

2019-11-18 22:14:09
字體:
供稿:網(wǎng)友
Paging through a recordset
by Daniel Adrian

Skill level: Beginner

First posted: Monday, October 09, 2000





Paging through a recordset

When I want to develop an application with a lot of records to show, I make pages so I can easily navigate
through the database and make the page look good and load quickly.

This can be done very easily. Shall we start?

Take a look at these next lines of code:

If Request.QueryString("Page") = "" Then
        Page = 1
    Else
        Page = Request.QueryString("Page")
    End If

    recordsToShow = 20
   n = 0



These lines of code are saying if the value of Request.QueryString("Page") is without any value then page
=1 else page gets the page the user requested. Recordstoshow is the number of lines in each page.
N is number of records PRinted.

Now lets put it into action:
objrs.PageSize = recordsToShow



(objrs is ADODB.Recordset Object)



In pagesize we are telling the record set that every page will have 20 records because recordstoshow is 20.

Now let’s pull out some records:

Do until objrs.EOF
if n = recordsToShow then
exit do
end if
write what that you want here
n=n+1
loop



Now we are writing date for the database and every time that we are repeating the loop we check if we done
it 20 times some when it’s 20 we will stop the loop.

Now let’s write the navigation:

if Page <> 1 then
Response.Write "<a href=pagename.asp?currentPage=" & currentPage - 1 &">"
end if
Response.Write "<< Back "

   if Page <> 1 then
   Response.Write "</a>"
   end if

'-------------------------
  For intCount = 1 to objRs.PageCount
   
   If intCount = 1 then
      Response.Write " | "
   End If
   
   If cint(intCount) = cint(Page) then
      Response.Write "<font color=darkblue><b>" & intCount & "</b></font> | "
   Else
Response.Write "<a hr ef=pagename.asp?currentPage=" & intCount & """>" & intCount & "</a> | "
   End If
   
Next
'-------------------------
if cint(page) = cint(objRs.PageCount) then
Response.Write "<a href=pagename.asp?currentPage=" & currentPage + 1 & ">"
end if
Response.Write " Next >> "
if cint(Page) = cint(objRs.PageCount) then
Response.Write "</a>"
end if



First we are checking if the current page is not 1 so it’s more then one so we can go back.

After this we need to write all of the pages in the record set.
Now we need to check if we can do next.

That is all! Yes it’s that easy!


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 中文字幕在线不卡视频 | 久久国产一二三 | 久草在线手机视频 | 国产91久久久久久 | 激情亚洲一区二区三区 | 精品一区二区三区欧美 | 久久国语对白 | 伊人在线视频 | 久久久一区二区三区四区 | free国产hd老熟bbw | 久草成人在线观看 | 国产色91 | 成人免费入口 | japanese javhd| 一级在线免费观看视频 | 午夜视频在线观看91 | 精品一区二区在线观看视频 | 免费国产在线精品 | 欧美另类视频在线 | 日本精品黄色 | 国产精品免费在线 | 成人免费一区 | 国产日韩中文字幕 | 久久久国产精品免费观看 | 日韩精品dvd| 九九热精品在线播放 | 国产成人高清在线 | 日本娇小videos高潮 | 一级毛片播放 | 亚洲精品永久视频 | 日本黄色免费片 | 精品中文字幕视频 | 精品少妇v888av | 影视免费观看 | 国产午夜精品久久久久 | 久草在线视频看看 | 久久久久国产成人精品亚洲午夜 | 中文字幕国产亚洲 | 久久久噜噜噜久久熟有声小说 | 亚洲一区动漫 | 56av国产精品久久久久久久 |