首先定义相关实体类:
分页信息类:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace BookShopModel
{
/// <summary>
/// 封装分页信息
/// </summary>
[Serializable]
public class PageInfo
{
//-------------------------------条件部分---------------------------------
private String _tableName;
/// <summary>
/// 表名(可以是一个子查询)
/// </summary>
public String TableName
{
get { return _tableName; }
set { _tableName = value; }
}
private String _pkey;
/// <summary>
/// 主键
/// </summary>
public String Pkey
{
get { return _pkey; }
set { _pkey = value; }
}
private int _pageSize = 10;
/// <summary>
/// 页大小
/// </summary>
public int PageSize
{
get { return _pageSize; }
set { _pageSize = value; }
}
private int _pageIndex = 1;
/// <summary>
/// 页号
/// </summary>
public int PageI