SqlKata - 我不明白 Paginate 是如何工作的
SqlKata - I'm not understanding how Paginate works
我是这个库 SqlKata 的初学者,我很难理解 Paginate 方法的功能。
使用 Get 方法,我可以访问 SQL 条记录。但是使用分页我不能。 Paginate方法会给我带来数据库的记录吗?
dim db = new QueryFactory(new SqlConnection("[connection-string]"), new SqlServerCompiler())
dim library = db.Query("my_table").Select("*").Paginate(1, 10)
for each book in library.each
response.write(book.id)
next
这会引发错误:
Public member 'id' on type 'PaginationResult(Of Object)' not found.
系统信息:
SqlKata 1.1.3
Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0
VB.NET
文档似乎需要更新。
以下是我使用分页的方法:
dim db = new QueryFactory(new SqlConnection("[connection-string]"), new SqlServerCompiler())
dim q = db.Query("my_table")
'Just if you need to know total of pages and other utilities
dim info = q.Paginate(1, 10)
'DB rows
for each book in info.list
response.write(book.id)
next
'If you do not need the pagination object, you can use:
'here we retrieve 10 records from page 2
for each book in q.ForPage(2, 10).Get()
response.write(book.id)
next
我是这个库 SqlKata 的初学者,我很难理解 Paginate 方法的功能。
使用 Get 方法,我可以访问 SQL 条记录。但是使用分页我不能。 Paginate方法会给我带来数据库的记录吗?
dim db = new QueryFactory(new SqlConnection("[connection-string]"), new SqlServerCompiler())
dim library = db.Query("my_table").Select("*").Paginate(1, 10)
for each book in library.each
response.write(book.id)
next
这会引发错误:
Public member 'id' on type 'PaginationResult(Of Object)' not found.
系统信息:
SqlKata 1.1.3
Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0
VB.NET
文档似乎需要更新。
以下是我使用分页的方法:
dim db = new QueryFactory(new SqlConnection("[connection-string]"), new SqlServerCompiler())
dim q = db.Query("my_table")
'Just if you need to know total of pages and other utilities
dim info = q.Paginate(1, 10)
'DB rows
for each book in info.list
response.write(book.id)
next
'If you do not need the pagination object, you can use:
'here we retrieve 10 records from page 2
for each book in q.ForPage(2, 10).Get()
response.write(book.id)
next