asp.net 源码保存 用程序分页
2024-07-10 12:42:08
供稿:网友
源码:
代码如下:
namespace Alex
{
public class PageTools
{
/// <summary>
/// 表名称
/// </summary>
private string tableName;
public string TableName
{
get { return tableName; }
set { tableName = value; }
}
/// <summary>
/// 返回的列名
/// </summary>
private string returnColumns;
public string ReturnColumns
{
get { return returnColumns; }
set { returnColumns = value; }
}
/// <summary>
/// 条件
/// </summary>
private string where;
public string Where
{
get { return where; }
set { where = value; }
}
/// <summary>
/// 排序列
/// </summary>
private string orderColumnName;
public string OrderColumnName
{
get { return orderColumnName; }
set { orderColumnName = value; }
}
/// <summary>
/// 排序,true为降序
/// </summary>
private Boolean orderDesc;
public Boolean OrderDesc
{
get { return orderDesc; }
set { orderDesc = value; }
}
/// <summary>
/// 主键
/// </summary>
private string keyColumnName;
public string KeyColumnName
{
get { return keyColumnName; }
set { keyColumnName = value; }
}
/// <summary>
/// 页面大小
/// </summary>
private Int32 pageSize;
public Int32 PageSize
{
get { return pageSize; }
set { pageSize = value; }
}
/// <summary>
/// 第几页
/// </summary>
private Int32 pageIndex;
public Int32 PageIndex
{
get { return pageIndex; }
set { pageIndex = value; }
}
/// <summary>
/// SQL参数
/// </summary>
private SqlParameter[] whereParams;
public SqlParameter[] WhereParams
{
get { return whereParams; }
set { whereParams = value; }
}
/// <param name="TableName"></param>
/// <param name="ReturnColumns"></param>
/// <param name="Where">条件</param>
/// <param name="OrderColumnName">排序列</param>
/// <param name="OrderDesc">排序,true为降序</param>
/// <param name="KeyColumnName">主键</param>
/// <param name="PageSize">页面大小</param>
/// <param name="PageIndex">第几页</param>
/// <param name="WhereParams">SQL参数</param>
public PageTools(string tableName, string returnColumns, string where, string orderColumnName, Boolean orderDesc,
string keyColumnName, Int32 pageSize, Int32 pageIndex, params SqlParameter[] whereParams)
{
this.TableName = tableName;
this.ReturnColumns = returnColumns;
this.Where = where;
this.OrderColumnName = orderColumnName;
this.OrderDesc = orderDesc;
this.KeyColumnName = keyColumnName;
this.PageSize = pageSize;
this.PageIndex = pageIndex;
this.WhereParams = WhereParams;
}
public PageTools() { }
public DataTable RetrievePagerData()