逐页显示网格视图中的数据 [英] Displaying data in grid view page by page
问题描述
我还想显示有多少页面。我们可以在vb.net [winform] gridview中实现这个概念。我正在使用数据库PostgreSQL。
任何人可以给我一个提示或一些概念?
请查看PostgreSQL中的 OFFSET和LIMIT 。< br>
您对第5页的查询可能如下所示:
SELECT *
FROM tbl
ORDER BY id
OFFSET 400
LIMIT 100;
总页数: 如果您想要将数字四舍五入,只需简化为: 两个数字都是整数,结果将是一个整数类型,小数位数自动截断。但我想你需要在这里进行整理。 I have more than 30,000 rows in a table. It takes a lot of time to load all the data in the gridview. So I want to display 100 rows at a time. When I click next page button, another 100 rows should be displayed. When I click previous page button, previous 100 rows should be displayed. If I type page 5 in a text box, then I want to jump over to the 5th lot of rows. I also want to display how many pages there will be. Can we implement this concept in vb.net [winform] gridview. I am using database PostgreSQL. Can anybody give me a hint or some concept? Look at OFFSET and LIMIT in PostgreSQL. Total number of pages: If you wanted the number rounded down, just simplify to: With both numbers being integer the result will be an integer type and fractional digits truncated automatically. But I think you need to round up here. 这篇关于逐页显示网格视图中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! id
是主键在我的例子中,因此索引自动到位。
如果以这种方式访问表格很多,性能可能会从使用
SELECT ceil(1235 :: real / 100):: int
FROM tbl;
SELECT 1235/100
FROM tbl;
Your query for the 5th page could look like this:SELECT *
FROM tbl
ORDER BY id
OFFSET 400
LIMIT 100;
id
is the primary key in my example, therefore an index is in place automatically.
If you access the table a lot in this fashion, performance may profit from using CLUSTER.SELECT ceil(1235::real / 100)::int
FROM tbl;
SELECT 1235 / 100
FROM tbl;