乙個取分頁sql函式

2021-04-19 08:13:41 字數 630 閱讀 4506

public static string getpageinfosql(int top, int page, string sql)

string addwhere = "";

if (sql.indexof("from") != -1)

addwhere = sql.substring(sql.indexof("from"));

addwhere = primarykey + " not in (select top " + (top * (page - 1)).tostring() + " " + primarykey + " " + addwhere + ") ";

if (sql.lastindexof("where") != -1)

sql = sql.insert(sql.lastindexof("where") + 6, addwhere + "and ");

else if (sql.lastindexof("order") != -1)

sql = sql.insert(sql.lastindexof("order"), "where " + addwhere);

else

sql += " where " + addwhere;

return sql;}}

乙個分頁取資料的儲存過程

sqlserver裡乙個用於分頁取資料的儲存過程,希望大家多多指教 create procedure dbo.gy getpagerecord tbname sysname colkey sysname colselect nvarchar 1000 countperpage int,pageind...

分享乙個通用的分頁SQL

又很久沒寫部落格,今天記錄乙個sqlserver通用分頁儲存過程 適用於sqlserver2000及以上版本 1.支援連表 2.支援條件查詢 use mydb go object storedprocedure dbo sp commonpage set quoted identifier on g...

乙個高ai的分頁函式和乙個url函式

aidu ad 這個分頁 函式非常高只能的 看看就知道了 function ppage total,page,e page 15,e block 10,url color totalpage ceil total e page 頁面數目 p block ceil totalpage e block ...