首页 > 编程 > .NET > 正文

asp.net 无刷新分页实例代码

2024-07-10 12:46:08
字体:
来源:转载
供稿:网友

数据类代码:

代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Reflection;

namespace DAL
{
    public  class UserManageClass
    {
        /// <summary>
        /// 取得总页数
        /// </summary>
        /// <returns>总页数</returns>
        public int GetPageCount()
        {
            int counts;
            string SqlStr = "select count(0) from [User]";
            counts = new SQLHelper().Content(SqlStr, CommandType.Text);
            return counts;
        }
        /// <summary>
        /// 取出每一页的内容
        /// </summary>
        /// <param name="SatrPage">开始页数</param>
        /// <param name="EndPage">结束页数</param>
        /// <returns>每一页的内容</returns>
        public DataTable GetPageDate(string SatrPage, string EndPage)
        {
            DataTable dt;
            string SqlStr = @"select * from
            (select *, ROW_NUMBER() over(order by id)as no_ from [User])aa
            where aa.no_ between '"+SatrPage+"' and '"+EndPage+"'";
            dt = new SQLHelper().ExecuteQuery(SqlStr, CommandType.Text);
            return dt;
        }

        /// <summary>
        /// 将一个DataTable转换成列表
        /// </summary>
        /// <typeparam name="T">实体对象的类型</typeparam>
        /// <param name="dt">要转换的DataTable</param>
        /// <returns></returns>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表