Use the KeleyiSQLHelper class for paging query.

Source: Internet
Author: User

Use the KeleyiSQLHelper class for paging query.

This article applies to querying by page in a single primary key table or view on SQL server. It supports multi-field sorting.

For the latest KeleyiSQLHelper class code, go
Http://hovertree.codeplex.com/SourceControl/latest
Download the source code of the entire solution.

You can also directly view the class code online:
Http://hovertree.codeplex.com/SourceControl/latest#HoverTree.DBTools/KeleyiSQLHelper.cs

Paging query method (in KeleyiSQLHelper. cs ):

public static DataTable HvtPageQuery(string tableName, string fieldList, string primaryKey, string wherePart, string orderPart  , int sortType, int pageSize, int pageIndex, int recorderCount, out int totalCount, out int totalPageCount)

Call method example (in callback .) :

public System.Data.DataTable HvtPageQuery(int sortType, int pageSize, int pageIndex, out int totalCount, out int totalPageCount)  {  return KeleyiSQLHelper.HvtPageQuery(" hovertree_usermessage ", " * ", " hvtId ", " hvtId>0 ", " hvtId desc ", sortType, pageSize, pageIndex, 0, out totalCount, out totalPageCount);  } 

This is a paging query of the hovertree_usermessage table to obtain all fields. The primary key is hvtId. For the final result, run the following page: HoverTreeWeb/HVTPanel/UserMessage/MessageList. aspx.


The paging query of KeleyiSQLHelper depends on an SQL stored procedure P_HvtPage, the Stored Procedure Code: http://keleyi.com/a/bjae/di5h0hui.htm

It is easier to know how to perform paging query by downloading the HoverTree source code.

 

Related Article

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.