Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset pagination

Status
Not open for further replies.

diembi

Programmer
Sep 22, 2001
238
0
0
ES
Hello,
i need obtain pages in a recordset for a very large query without get all records in the recordset. If I use OleDbDataAdapter.Fill(DataSet, startRecord, maxRecords, "tablename") the sqlserver gives me all records (1000000) and after this the pagination show me the records in X records. I would like the sqlserver gives me the records in pages with 1000 records(for example) and after show these 1000 records.

Thank you!!!
 
which database are you using? if the db provides a pagination operator use this (check the db's docs or db specific forum if you don't know).
if the db doesn't have pagination, then you will need to:
1. fetch all the records into the dataset/table.
filter the subset of records and pass that to the presentation.
2. create a set of temp tables/sub queries to filter out the correct records. and load the dataset/table as you normally would.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hello,
the database is Microsoft® SQL Server™ 2000. Thank you.
 
I would do this at the SQL Server level. You could write a query that returned the first 100 results, then after that returned the next 100. A Stored Proc with a parameter passed to it. SQL Server 2005 has a ROW_COUNT function which helps out with paging...2000 doesn't have anything like that so you will have to write your own. Check out this article:
I haven't used that, but seemed like it would work.

Regards,

J
 
Hello jshurt,
thanks a lot. Good method.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top