473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

paging with disconnected data

Hi guys,

I've learnt thata SQLDataAdapters support paging with the overloaded FILL
method (having start record & max records as parameters).
& also learnt that the ideal way to achieve paging is not using this,
rather, using the TOP & ORDER BY keyword in the SELECT command to limit the
records to what i need.

Okay,
Following is the scenario,
Table = AdrBook
Fields = Id (Key field, autoincrement - Integer)
ContactId (Candidate Key, string)
First Name (string)
Age (integer)

Now, there are 1000 records (1000 contacts)

In the form (windows application), i put a request to the server to fetch
the records 10-20 (via a webservice).
The data should be sorted by the Age field in Ascending order.

The select command i wouild use is

SELECT TOP 10 * FROM AdrBook WHERE ID IN
(SELECT TOP 20 ID FROM AdrBook ORDER BY Age ASC)
ORDER BY Age DESC

Using the above select, i get exactly what i want.
This will work for multiple ORDER BY clauses. The inner select will have the
actual ORDER BY, but the
outer select will have the reversed ORDER BY.

Now, my problem.

The final output gives me exaclty what i want.
But, the data is ordered in the reverse order. (how can i fix this).

So i fixed this, by using the following SELECT

SELECT TOP 10 * FROM AdrBook WHERE ID IN
(SELECT TOP 10 ID FROM WHERE ID IN
(SELECT TOP 20 ID FROM AdrBook ORDER BY Age ASC)
ORDER BY Age DESC)
ORDER BY Age

Now, as you can see, i've got 3 selects from AdrBook.
1). Does this have any implications on performance???

2). Does anyone have a better way ot doing paging?

Regards,
Paul
Nov 20 '05 #1
0 916

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
2
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary...
6
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP...
2
by: asad | last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom paging bcoz data is too heavy so pls tell me how can i use custom paging in ASP.NET Thanks
2
by: | last post by:
Hello, I have a GridView in my ASP.NET 2.0 application that performs the paging feature perfect when I have it bound to a data source. But now I have it bound to a dataset and the paging...
2
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is...
8
by: AG | last post by:
ASP.NET 2.0, VS 2005 I have a gridview with paging enabled, bound to an objectdatasource. Both were dropped on to the page and configured via the wizards. Basically working as expected. The...
5
by: Donald Adams | last post by:
Hi, I will have both web and win clients and would like to page my data. I could not find out how the datagrid control does it's paging though I did find some sample code that says they do it...
6
by: Yosi | last post by:
Hi all, I have access database file with 2 tables, the tables have the same columns but with different data, and I have 2 asp files that show the content of each table with paging recordset,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.