?
Solved

Datasets and paging

Posted on 2005-03-21
4
Medium Priority
?
215 Views
Last Modified: 2010-04-16
Hi
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
0
Comment
Question by:cossy74
[X]
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
4 Comments
 
LVL 9

Accepted Solution

by:
sun4sunday earned 800 total points
ID: 13598022
0
 
LVL 13

Assisted Solution

by:dungla
dungla earned 400 total points
ID: 13598033
cossy74,

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
0
 
LVL 22

Assisted Solution

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

  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)
            {
                  FillData();
            }

            private void FillData()
            {
                  da.Fill(ds,"Products");
                  DataGrid1.DataSource = ds.Tables[0];
                  DataGrid1.DataBind();
            }

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


HTH

Regards,
Mohammed
0
 

Author Comment

by:cossy74
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
Fill(dataset,recordnumber,pagelimit,table)

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.
0

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