最好用的相容多種資料庫通用高效的大資料分頁功能

2022-02-09 01:12:54 字數 3846 閱讀 5373

通用許可權管理系統底層有乙個通用分頁查詢功能,該功能可實現多種資料庫的查詢,支援多表關聯分頁查詢,目前是最完善的分頁功能實現。

下面**是使用的方法截圖:

///////////////////////////////

後台**截圖1

後台**截圖2

後台**截圖3

後台**截圖4

後台**截圖5

頁面後台**實現參考:

public partial class tabsite : authbasepage

%", searchkey);

}listwhere.add("( b.site_code like " + dbhelper.getparameter("searchkey") + "or b.site_name like " + dbhelper.getparameter("searchkey") + " or b.manager like " + dbhelper.getparameter("searchkey") + ")");

dbparameters.add(new keyvaluepair("searchkey", searchkeytmp));

}if (listwhere.count > 0)

if (string.equals(outputmode, "pagerlist", stringcomparison.ordinalignorecase))

else if (string.equals(outputmode, "dropdownjson", stringcomparison.ordinalignorecase))

else if (string.equals(outputmode, "gridjson", stringcomparison.ordinalignorecase))

else

span = datetime.now - begin;

response.write(jsonstring);

response.end();

}else}}

///////////////////////////////

分頁功能呼叫**

/// /// 吉日嘎拉 獲取分頁資料(防注入功能的) 

/// 宋彪 2014-06-25 構造list>比idbdataparameter方便一些

/// dbhelper.makeparameters(dbparameters)--》idbdataparameter

///

/// 記錄條數

/// dbhelper

/// 資料**表名

/// 選擇字段

/// 當前頁

/// 每頁顯示多少條

/// 查詢條件

/// 查詢引數

/// 排序字段

/// 資料表

public static datatable getdatatablebypage(idbhelper dbhelper, out int recordcount, string tablename, string selectfield, int pageindex, int pagesize, string conditions, list> dbparameters, string orderby)

return result;

}

///////////////////////////////

底層分頁功能實現,可通過原始碼檢視

/// /// oracle 獲取分頁資料(防注入功能的)相容多種資料庫

///

/// 資料庫連線

/// 資料**表名

/// 選擇字段

/// 當前頁

/// 每頁顯示多少條

/// 查詢條件

/// 查詢引數

/// 排序字段

/// 資料表

public static datatable getdatatablebypage(idbhelper dbhelper, string tablename, string selectfield, int pageindex, int pagesize, string conditions, idbdataparameter dbparameters, string orderby, string currentindex = null)

if (!string.isnullorempty(conditions))

string sqlquery = string.empty;

if (dbhelper.currentdbtype == currentdbtype.oracle)

sqlquery = string.format("select * from(select rownum rn, h.* from ((select " + currentindex +" "+ selectfield+" from )h)) z where z.rn <= and z.rn >"

, tablename, conditions, orderby, sqlend, sqlstart);

}else if (dbhelper.currentdbtype == currentdbtype.sqlserver)

) as rowindex, " + selectfield + " from ) as pagetable where rowindex between and "

, orderby, tablename, conditions, sqlstart, sqlend);

}else if (dbhelper.currentdbtype == currentdbtype.mysql

|| dbhelper.currentdbtype == currentdbtype.sqlite)

from order by limit , ", selectfield, tablename, conditions, orderby, sqlstart, pagesize);

}var dt = new datatable(tablename);

if (dbparameters != null && dbparameters.length > 0)

else

return dt;

}

這個分頁功能可以相容多種資料庫,多表關聯查詢

最好用的相容多種資料庫通用高效的大資料分頁功能

通用許可權管理系統底層有乙個通用分頁查詢功能,該功能可實現多種資料庫的查詢,支援多表關聯分頁查詢,目前是最完善的分頁功能實現。下面 是使用的方法截圖 後台 截圖1 後台 截圖2 後台 截圖3 後台 截圖4 後台 截圖5 頁面後台 實現參考 public partial class tabsite a...

多種資料庫操作

using system using system.data using system.configuration using system.linq using system.web using system.web.security using system.web.ui using syste...

Java多種資料庫連線

jdbc odbc string driver sun.jdbc.odbc.jdbcodbcdriver string url jdbc odbc dbsource dbsource為資料來源名 string username username 使用者名稱 string password passw...