DataReader also plays cool data display paging

zhaozj2021-02-16  54

Use DataReader to achieve paging, let me have a headache for many days. Why do I use the DataReader control to make paging? Let's take a look at this page (http://www.wrclub.net/MB/), maybe it is a bit clear! We can control the cross-routing of data! ASP.NET, the easiest to complete the paging operation is DataGrid, followed by the DataList control; but they limit the display of the data so that the data display is difficult to operate.

DataReader simulates the operation of fast and forward read-only cursors, complete paging is not possible, and the DataReader implementation paging can only be analyzed from SQL statement, but it is fully free to display data, we can define data according to your own wishes. Display method! The code is as follows: <% @ page language = "C #" debug = "true"%> <% @ outputcache duration = "3" VarybyParam = "none"%> <% @ Import namespace = "system.data"%> <% @Import Namespace = "System.Data.SqlClient"%>