Datasets and paging

Posted on 2005-03-21
Medium Priority
Last Modified: 2010-04-16
current i have a huge database of about 1mill + records that need to be able to be broswed.

What i would like is to bring over 50 records at a time and page through the database that way and therefore limit the amount of data be returned at any one time.

Could anyone point me in th eright direct. Either to a tutorial or some source code would be helpful
Question by:cossy74
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

sun4sunday earned 800 total points
ID: 13598022
LVL 13

Assisted Solution

dungla earned 400 total points
ID: 13598033

What kind is your application, winform or webform. If you are develop a winform application, then you cannot use paging.

If you are develop a webform, then set following property:

1. Right click on your data grid, select Property Builder
2. Select Paging from left panel, then tick Allow Paging.
3. Set Page size: to 50 rows
LVL 22

Assisted Solution

by:Mohammed Nasman
Mohammed Nasman earned 800 total points
ID: 13598581

  I prefer to limit the result on the server, because running query return 1 million records, and only show 50 record in client, will take the resource on the server

the best practile for this situation to limit the result from the query it self like

SELECT top 50 * FROM Products;

if your query result doesn't return much records, and you would to show them as pages

follow the dungla steps for adding the paging support to dataGrid, but you need to write code in PageIndexChanged event to show the right data when user move between pages

            private void Page_Load(object sender, System.EventArgs e)

            private void FillData()
                  DataGrid1.DataSource = ds.Tables[0];

            private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
                  DataGrid1.CurrentPageIndex = e.NewPageIndex;



Author Comment

ID: 13605470
dungla: I have found the Fill method has an overload that takes a dataset, the starting record, number to return, and the table. This seems to be working for me.

using a dataadapter i do

I am going to split the points between everyone because althouhg i found the result myself i think you all should get somethign for helping.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question