积极答复者
asp.net怎样使用存储过程实现多表搜索,并分页显示?

问题
答案
-
Hi yph518,
有關您的需求,我找到一篇文章有提到Repeater如何做分頁,希望對您有幫助。
Repeater, DataList 等資料控制項要怎麼實做分頁,保哥,The Will Will Web
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/- 已标记为答案 Alan_chenModerator 2011年10月3日 7:46
-
如果你存储过程是你写的,你完全可以用传人参数来选择你要显示的条数,分页的时候就去查询下
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Alan_chenModerator 2011年10月3日 7:46
全部回复
-
根據你的需求嘗試提供其中一種寫決方式,以下說明以SQL SERVER儲存資料,使用GridView來呈現資料以及用SqlDataSource才存取資料為例:
有關查詢的部分可以用下列T-SQL來進行模糊查詢:
create procedure usp_GetTable12 (@name varchar(10)) as select * from table1 t1 inner join table2 t2 on t1.BID = t2.BID where t1.Name like '%'+@name+'%' go
顯示當前頁數可用GridView1.PageIndex。
顯示總頁數可用GridView1.PageCount。
總紀錄數可以在SqlDataSource的Selected事件中以e.AffectedRows來取得影響筆數,也就是總紀錄數。
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/ -
Hi yph518,
有關您的需求,我找到一篇文章有提到Repeater如何做分頁,希望對您有幫助。
Repeater, DataList 等資料控制項要怎麼實做分頁,保哥,The Will Will Web
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/- 已标记为答案 Alan_chenModerator 2011年10月3日 7:46
-
如果你存储过程是你写的,你完全可以用传人参数来选择你要显示的条数,分页的时候就去查询下
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Alan_chenModerator 2011年10月3日 7:46