I am a beginner using this library SqlKata, and I'm having hard time understanding the functionality of the Paginate method.
With the Get method, I can access the SQL records. But with Paginate I can not. Will the Paginate method bring me the records of the database?
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
This throws a error:
Public member 'id' on type 'PaginationResult(Of Object)' not found.
System information:
SqlKata 1.1.3
Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0
VB.NET
It looks like the documentation needs an update.
Here's how I managed to use the pagination:
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