Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个巨大的表,我需要实现一个(网络)控件,以允许我浏览所有记录、分页、过滤和排序它们。我的第一个想法是实现一个 DataGrid/something 并将读取的 DataTable 作为 DataSource(使用“视图”或简单的 sql“全选”语句),然后过滤 DataTable 对象(DataView.RowFilter 等)。据我所知,在读取所有记录之后,这种排序/过滤是在客户端完成的。有没有更优雅/有效的方法来做到这一点(意思是 - 只需从数据库服务器读取您需要的记录)?
对于像 GridView 这样的控件,每次选择页面时,默认分页都会从数据库中检索所有行。
不是很有效吗?但是,您可以使用自定义分页仅检索当前所选页面所需的那些记录。
这是一个例子:http ://www.asp.net/web-forms/tutorials/data-access/paging-and-sorting/efficiently-paging-through-large-amounts-of-data-cs