<1>
First we declare the definition stored procedure in the database (SQL Server)
Use Salesif (Exists (SELECT * from sys.objects where name= ' proc_location_paging ')) drop proc Proc_location_paginggocreate Proc proc_location_paging--Create stored procedure (@pageSize int,--page size @currentpage int,--current page @rowcount int output,--Total number of rows (outgoing parameters) @pageC ount int output--Total number of pages (outgoing parameter)) Asbeginselect @rowCount = COUNT (locid) from location--assigns @rowcount to select @pageCount = CEILING ((Count (locid) +0.0)/@pageSize) from location-assigns @ @pageCount select TOP (@pagesize) * FROM (select Row_number () over ( Order by Locid) as rowid,* from location) as T1where RowID > (@pageSize * (@currentpage-1)) Endgo---------------------------------above means that the stored procedure is already defined. ---------------------------------The following is the execution of this stored procedure. We can see the result declare @rowCount int, @pageCount INT--Declare two parameters first-execute proc_location_paging this stored procedure. @rowCount, @pageCount have output at the back to indicate that both of them are out-of-parameters exec proc_location_paging 10,1, @rowCount output, @pageCount output SELECT @ RowCount, @pageCount--Query the values of these two parameters
Ajax Paging (content related to stored procedures)