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.