I recently learned the data paging technology in webcast. Now I have summarized the relevant knowledge points as follows to facilitate further summarization and review:
I. Data paging Overview:
1. Generally, when the displayed data volume is large on a web page, all data cannot be displayed on a single page.
2. In some specific scenarios, no data that meets the conditions needs to be returned.
3. From the data perspective, data within the specified range must be returned.
Ii. Paging Technology
1. Data Layer Technology:
Only data on a specific page is queried during database query.
Mainly done by T-SQL
Suitable for large data tables
Advantage: The returned result set is small and the query speed is fast.
Disadvantage: You need to query the database multiple times.
1.1 Use temporary tables
Create a temporary table before querying data
The column in the table has one more identifier column than the result to be returned.
Sort by specific columns and insert the results to the temporary table
In this case, you can return a specific page according to the ID column
1.2 use table Variables
Create a table variable before querying data.
The table column has one more ID column than the result set to be returned.
Sort by specific columns and insert the results into Table variables.
In this case, you can return a specific page according to the ID column
1.3 repeated top
To obtain data from rows 21-30 in the positive order of a specific column.
First, top 30 is obtained in positive order of a specific column.
Then, the top 10 is sorted in reverse order.
Finally, return the result after sorting the result.
1.4 Use row number
In SQL Server 2005/2008, add a row_number () in the query result set to indicate the row number.
Use the preceding result set as a subquery and use row_number () to filter out specific pages.
2. Application Layer Paging
Cache data at the application/logic layer and display data in Segments
MainlyProgramCodeComplete
Advantage: the number of queries to the database is small, and the results returned each time are fast.
Disadvantage: The first query is slow and occupies application-layer memory resources.
2.1 gridview + datasource
2.2 datapage + listview
3.3 skip and take methods in LINQ
3. Display layer Paging
Paging data on the client
Mainly implemented through client scripts
Advantage: reduces network transmission volume and improves bandwidth utilization
Disadvantage: a large number of client scripts are required to increase development and maintenance costs.
3.1 updatepanel
The updatepanel control in Asp.net AJAX can be used to convert the paging function provided by the application layer to the client.
You do not need to maintain the code and make full use of the functions of the server-side controls.
3.2 data services (. NET Framework 3.5)
Data Services provides URI-based Data Access to achieve data paging.
On the presentation layer, you can directly parse through JavaScript
Lightweight Data Transmission Format: XML/JSON
Best regards,
Charles Chen
Email: gotosunny@msn.com