數據類代碼:
代碼如下:
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>
新聞熱點
疑難解答
圖片精選