AJAX paging (content involves stored procedures)

Source: Internet
Author: User

AJAX paging (content involves stored procedures)

<1>

First, we declare and define the 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 a stored procedure (@ pageSize int, -- page size @ currentpage int, -- current page @ rowCount int output, -- total number of rows (outgoing parameter) @ pageCount int output -- total number of pages (outgoing parameter) asbeginselect @ rowCount = COUNT (locid) from location -- assign a value to @ rowCount: select @ pageCount = CEILING (count (locid) + 0.0)/@ pageSize) from location -- Assign a value to @ pageCount: select top (@ pagesize) * from (select ROW_NUMBER () over (order by locid) as rowID, * from location) as t1where rowID> (@ pageSize * (@ currentpage-1) endgo ----------------------------------- the above indicates that the stored procedure has been defined. --------------------------------- The following describes how to execute this stored procedure. We can see that the results declare @ rowCount int, @ pageCount int -- declare two parameters first -- execute the proc_location_Paging stored procedure. @ RowCount, @ pageCount is followed by output, which indicates that both of them are output parameters exec proc_location_Paging 10, 1, @ rowCount output, @ pageCount output select @ rowCount, @ pageCount -- query the values of these two parameters



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.