dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Web
Expertise: Intermediate
Dec 22, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


The Easiest Way for Recordset Paging Using ADO GetString


The following subroutine requires two parameters

1) Recordset

2) Count of records per page. For example:
 
    Call EasyPaging(Rs,10)


<%
Sub EasyPaging(MyRecordset,RecordsperPage)
 Dim CurrentPage,Myurl
 Myurl=Request.ServerVariables("script_name")
 MyRecordset.PageSize = RecordsperPage:MyRecordset.CacheSize =
RecordsperPage
 'get the current page number
 CurrentPage = Request.QueryString("Page")
 If CurrentPage = "" Or CurrentPage = 0 Then CurrentPage = 1
 MyRecordset.AbsolutePage = CurrentPage

 'write the content
 with Response
   .Write "<table border=0 width=""50%"" cellpadding=2 _
cellspacing=0>"
   .Write "<tr>"
  For Each myfld In MyRecordset.Fields
   .Write "<th width=""50%"" bgcolor='#0000A0' _
align=left><font
color='#FFFFFF'><b>" & myfld.Name & "</b></font></th>"
  Next
   .Write "</tr>"
   .Write "<tr><td width=""50%"">"
  'use getstring
   .write MyRecordset.GetString(2, RecordsperPage, _
"</td><td
width=""50%"">", "</td></tr><tr><td width=""50%"">", " ")
   .Write "</td></tr></table>"

  If CInt(CurrentPage) > 1 Then
   .Write "<a href=""" & Myurl & "?Page=" & _
(CurrentPage - 1 ) &
"""><Previous </a>  "
  End If
  If CInt(CurrentPage) < MyRecordset.PageCount Then
   .Write "<a href=""" & Myurl & "?Page=" & _
(CurrentPage + 1 ) &
""">Next></a>"
  End If

 End With
End Sub
%>
Harinatha Reddy
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date