浅析asp.net 和 access 联合开发的分页类_.Net教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:在ASP.Net Ajax中调用WebService
今天我想实现利用JavaScript调用WebService我首先就想到了ASP.Net Ajax 因为微软的东西用着方便,我从网上看了看,这东西好多人都写了,我就从官方找了个Demo下了看看源代码,感觉没什么特殊的

以下为引用的内容:
using System;
using
System.Collections.Generic;
using
System.Text;
using
System.Data;
namespace
pager
{
public class
Pager
{
/// <summary>

///
/// </summary>
/// <param name="strWhere">条件</param>
/// <param name="pagesize">每页显示条数</param>
/// <param name="pageindex">第几页</param>
/// <param name="orderCol">排序</param>
/// <param name="TableName">表名</param>
/// <returns></returns>
public static string GetPager(string strWhere, int pagesize, int pageindex, string orderCol, string TableName)
{
if (pageindex == 1
)
{
return "select top " pagesize.ToString() " * from " TableName.ToString() " order by " orderCol.ToString() " DESC"
;
}
else

{
StringBuilder strSql
= new StringBuilder();
strSql.AppendFormat(
"select top {0} * from {1} "
, pagesize, TableName);
strSql.AppendFormat(
" where {1} not in (select top {0} id from {2} ", pagesize * (pageindex - 1
), orderCol, TableName);
if (strWhere.Trim() != ""
)
{
strSql.AppendFormat(
" where {0} order by {1} DESC) and {0}"
, strWhere, orderCol);
}
else

{
strSql.AppendFormat(
" order by {0} DESC) ", orderCol);
}
strSql.AppendFormat(
" order by {0} DESC"
, orderCol);
return
strSql.ToString();
}
}
}
}

分享:asp.net 获取客户端IP与mac
获取客户端IP: 以下为引用的内容: private string GetClientIP() { string result = HttpContext.Current.Request.ServerVari

来源:模板无忧//所属分类:.Net教程/更新时间:2009-09-07
相关.Net教程