Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

577 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