【用recovery刷机】用RecordSet实现分页by Daniel Adrian

更新时间:2019-09-12 来源:刷机教程 点击:

【www.hzclsc.cn--刷机教程】

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 ""

 end if

Response.Write "<< Back "



   if Page <> 1 then

   Response.Write ""

   end if



'-------------------------

  For intCount = 1 to objRs.PageCount

   

   If intCount = 1 then

      Response.Write " | "

   End If

   

   If cint(intCount) = cint(Page) then

      Response.Write "" & intCount & "| "

   Else

 Response.Write "" & intCount & " | "

   End If

   

Next

'-------------------------

 if cint(page) = cint(objRs.PageCount) then

 Response.Write ""

 end if

 Response.Write " Next >> "

 if cint(Page) = cint(objRs.PageCount) then

 Response.Write ""

 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!



 

本文来源:http://www.hzclsc.cn/anzhuo/27840.html

为您推荐

360n6 pro|360n6 pro什么时候发布 360n6 pro发布会直播地址

您的位置:首页 → 资讯 → 硬件报道 → 360n6 pro什么时候发布 360n6 pro发布会直播地址 360n6 pro什么时候发布 360n6 pro发布会直播地址时间:2017 11 28硬件报道

2020-12-09 07:04:11   360n6lite   360n6换外屏   360n6刷机  

[小米平板刷机按哪个键]小米平板2刷机出现bootloader error code 03解决办法

您的位置:首页 → 资讯教程 → 教你一招 → 小米平板2刷机出现bootloader error code 03解决办法 小米平板2刷机出现bootloader error code 03解决办法时教你一招

2020-11-01 11:04:50  

【斐讯k2手机设置教程】斐讯k2刷潘多拉教程 斐讯k2刷潘多拉固件

斐讯k2刷潘多拉教程,斐讯k2刷潘多拉固件最近斐讯K2路由器因为0元购比较火爆,很多人都想知道斐讯k2路由器怎么刷潘多拉固件,小编在这里给大家介绍一下。斐讯K2刷潘多拉与华硕教程相同,无非最后上传的固教你一招

2020-10-27 07:05:14   斐讯路由k2刷机教程  

腾讯tos官网_腾讯TOS无线刷机教程 腾讯TOS怎么刷机

腾讯TOS公布开放测试之后发布了一款刷机神器——TOS无线刷机,让吐司们尝鲜体验刷机中的黑科技~ TOS无线刷机是一款自动刷入TOS系统的应用。打开应用点击“立即刷机”后,会自动完成机型检测、文件备知识加油站

2020-09-21 07:04:03  

小米4a 4c 4s 4x有什么区别|小米4 Win10刷机教程 小米4刷Win10图文教程详解

小米和微软合作为小米4适配了Win10 Mobile系统。最新Win10移动版10581官方已经公布支持小米4,网友的原创小米4 Win10刷机教程已经出炉,支持小米手机4手动刷入Win10 Mobiwindows10

2020-09-21 07:04:03   小米4c   小米4s   小米4a