Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2004, 01:33 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default fetching Recordset stage wise in to RS

Hi,
Can any one help me how to read the recordset stagewise by fixing some record-count size from Access using ADO in VB6.
 
Old October 6th, 2004, 04:09 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

ADO gives 3 properties to help you.

PageSize - sets / returns the number of records in a single page.

PageCount - returns the number of pages in a record set

AbsolutePage - Sets / returns the current page of records.

Here is a sample code.

option explicit
private iCurrentPage as integer

I am using a button to get the record set. On clicking the button, it will list records page by page.

In the click event, put the code.

If iCurrentPage="" then
    iCurrentPage = 1
else
    iCurrentPage = iCurrentPage +1
end if

' set ADO connection object. Let cnn be the ado connection object.
dim rs as new adodb.recordset
rs.CursorType=adopenstatic
rs.PageSize=10
rs.open <query to open record set>, cnn
rs.absolutepage=iCurrentPage
dim iRowCount as Integer
iRowCount=0
While not(rs.EOF) and iRowCount<rs.PageSize
    ' code to display record fields.
    iRowCount=iRowCount+1
    rs.MoveNext
wend
rs.close
set rs=nothing
' close connection

--------------------------------------------------------------

This code should be used only as a guide line. Please do not cut and paste. I have not had a chance to test it. I am writing it from my memory.

Best wishes
Madhu
 
Old October 7th, 2004, 07:32 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Madhu,
Thanks for your help and your thinking is correct here also we are fetching the entare records in to the recordset object and showing them page by page.. But my requirment is to insert from Access to Oracle which will have some 3 Lach records if i fetch the entair records in to the recordset then put the same in a loop to insert is taking time hence i want to realese the recordset pagesize wise after inserting in to the destination. I think now you got my requirement.

Yugandhar.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Rows Priority Wise Muhammad Zeeshan SQL Language 0 November 23rd, 2007 03:48 AM
Setting Background color of the Stage with AS robprell Flash (all versions) 2 December 12th, 2005 02:51 PM
is it wise? kuehhc Beginning PHP 4 December 20th, 2004 12:09 PM
RS Manager and RS Server on 2 different computers Choose File BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 22nd, 2004 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.