/* 數據庫分頁存儲過程---equn.net 參數說明: ?tablename為搜索表名 ?where為搜索表名,要顯示所有記錄請設為"1=1" ?orderby為搜索結果排序,如order by id desc ?curpage當前頁碼 ?page_record每頁記錄條數 結果: ?返回表tablename中滿足條件where的第curpage頁的page_record條記錄,結果按orderby排序 */ create procedure xp_page(@tablename varchar(50),@where varchar(100),@orderby varchar(100),@curpage int,@page_record int) ?as begin ?declare @cmd varchar(500) ?declare @uprecord int ?set @[email protected] * @page_record ?set @cmd='select top '+cast(@page_record as char)+' * from '[email protected]+' where '[email protected]+' and id not in (select top '+cast(@uprecord as char)+' id from '[email protected]+' where '[email protected]+' '[email protected] +') '[email protected] ?exec(@cmd) end go,歡迎訪問網頁設計愛好者web開發。