How to select part of table and shown on GRID object?

I have a batch trend table about 10000 rows. But I want to show batch data on GRID per 10 rows. while pressing "next page" button, grid will show next 10 data points , and so on , and can operate reversely.
I can do this only show first 10 rows by following script.
How do I let the grid to show the next 10 data points on the same grid which is fix 10 rows?
Could you help me, please?

Thanks.

==================================================================================================
Dim Mystring, NumCur, i

Mystring="SELECT * FROM TREND002 WHERE Time_Stamp Between '2020-07-31 13:45:00' and '2020-07-31 15:00:00'" 'Batch start and Batch Stop'
NumCur=$DBCursorOpenSQL("Acquire",Mystring) ' select this batch'
$RowQty=$DBCursorRowCount(NumCur) 'count total row quanty'

For i = 0 To 9
$sample[i].sTime=$DBCursorGetValue(NumCur,"Time_Stamp")
$sample[i].idata=$DBCursorGetValue(NumCur,"data1")
$DBCursorNext(NumCur)
Next


NumCur=$DBCursorClose("Acquire",Mystring)
  • WITH SomeSelection AS
    (
    SELECT [columns], ROW_NUMBER() OVER (ORDER BY [YourColumnToOrder]) AS RowNumber
    FROM TREND002 WHERE Time_Stamp Between '2020-07-31 13:45:00' and '2020-07-31 15:00:00'
    )
    SELECT [columns], RowNumber
    FROM SomeSelection
    WHERE RowNumber BETWEEN [StartRow] AND [EndRow]

    I hope I have helped