Quick Search for:  in language:    
   Code/Articles ╗ |  Newest/Best ╗ |  Community ╗ |  Jobs ╗ |  Other ╗ |  Goto ╗ | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 2,528,438 lines
 Jobs: 286 postings

Sponsored by:


You are in:


Latest Code Ticker for Visual Basic. ownerdrawn frame control with rounded corners
By Eric... on 10/24

AS400 / DB2 Connection
By Shaji John on 10/24

TIFF scanner multipagina
By Jose R. on 10/24

Click here to see a screenshot of this code!Code Viewer
By Just My Stuff on 10/24

(Screen Shot)

Click here to see a screenshot of this code!Simple 8bit Encryption
By George Vassilenko on 10/24

(Screen Shot)

Click here to see a screenshot of this code!EuroDepth 2.0 (Now Handles 1, 4, 8, 15, 16, 24(32), 24(64) bit depth's) SUPER FAST! See Screen Shot!
By James Dougherty on 10/24

(Screen Shot)

Click here to see a screenshot of this code!Database Grid
By chris.berry on 10/24

(Screen Shot)

Click here to see a screenshot of this code!Employee Taxes
By chris.berry on 10/24

(Screen Shot)

[[ A scroll flexgrid with mouse wheel
By Pamela RAI on 10/24

Click here to put this ticker on your site!

Add this ticker to your desktop!

Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites


Paged Record Using GetRows Method


Submitted on: 10/3/2002 7:33:02 AM
By: Muhannad Yousef 
Level: Advanced
User Rating: Unrated
Compatibility:VB 6.0

Users have accessed this article 466 times.
(About the author)
     Paging through Records using a GetRows and PageSize,PageCount,AbsolutePage

Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
As an ASP developer, I am constantly looking for new source code examples that will help make my job easier. Of course, using someone else's examples is far simpler than enduring the pain of the development process. One of the examples I have seen on various sites involves paging through recordsets on a web page N records at a time. Most developers want to do this rather than present the entire recordset on a single page. First, this has the advantage of making faster page loads for site visitors, and secondly it makes for nicer pages. All of the examples I have seen use client-side cursors to move to an absolute page in the recordset. While this works quite nicely, there is one disadvantage that developers don't consider. In most cases, the server where the database resides is separate from the web server. Whenever a request is made to the database server, it returns the entire recordset to the web server, which then uses the client-side cursor to only select the group of records requested for the given page. This does not seem like a problem until you consider what happens when you are working with large databases and multiple concurrent users. If you are only requesting 40 records at a time from a 100,000 record database table, and you have 5 people make the same request, you are now sending 500,000 records to the web server for only 200 records of output to the client. This can be an enormous problem! i solved this problem by using both GetRows method and PageSize,PageCount,AbsolutePage, here is the search function, ---------------------------------------------------------------------------------------------------- Function Search (KW as string,m__CurPage as long,m__RPerPage as long)
con.Open Connection_string Q = "SELECT itmID,ItmName,ItmUrl,ItmAbout From Information where ItmName like '%" & KW & "'%" rs.CursorLocation = adUseClient rs.Open Q, con, adOpenDynamic, adLockOptimistic rs.PageSize = m__RPerPage Total_Pages = rs.PageCount rs.AbsolutePage = m__CurPage m_RecordFound = rs.RecordCount If Not rs.EOF Then SearchArr = rs.GetRows(m__RPerPage, rs.Bookmark) Search = SearchArr End If
con.Close End Function
---------------------------------------------------------------------------------------------------- with this code there is no load on the web server, all the loads moves to the Database. the function here take 3 paremeter, the first one is the search Keyword and the second one is the page number,and the 3rd one is the number of record per page, the function return a two dimensional array contains the number of record depend on the 3rd parameter.

Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Your Vote!

What do you think of this article(in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
Other User Comments
10/3/2002 12:15:05 PM:
Hi, how is there no load on the web server? All the data is loaded into a client side cursor and then the paging is done on the server.
Keep the Planet clean! If this comment was disrespectful, please report it:

Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.


Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyrightę 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.