When the data volume of the database is relatively large and the execution efficiency is higher, we can consider using the stored procedure to implement paging, returning the data table that needs to be displayed according to the number of pages passed in, select only the data of the current page. (This is much more efficient than using PagedDataSource classes.) )
Now uses repeater to implement a data paging, the database uses the SQL server2000, uses inside the system table Northwind.
The new stored procedure is as follows:
Create PROCEDURE dbo.mypaging
(
@pagesize int,
@currentPage int,
@total int output
)
as CREATE TABLE #temp
(
ID int identity (1,1),
CustomerID varchar (m),
CompanyName varchar (
), ContactName varchar (m),
contacttitle varchar,
Phone varchar ()
)
insert INTO #temp ( Customerid,companyname,contactname,contacttitle,phone)
Select Customerid,companyname,contactname, Contacttitle,phone from
Customers
Select @total = (select count (*) from Customers)
declare @startID int< C21/>declare @endID int
Set @startID = (@currentpage-1) * @pagesize +1
Set @endID = @currentpage * @pagesize
SELECT * from #temp where id>= @startID and id<= @endID
Go
If you do not write stored procedures, you can refer to the Web site online raw page stored procedures: http://www.webdiyer.com/AspNetPager/utility/sqlspgen.aspx