Paging

RapTier generates the GetAsArray and GetAsDataTable methods that retrieve a specified number of records from a table starting at a specified record position. You may use these methods to implement paging, passing the (PageNumber - 1) * PageSize expression in the startIndex parameter and PageSize in the length parameter.

Example:

[C#]

public UserRow[] GetUserPage(int pageNumber, int pageSize)
{
    using(MyDb db = new MyDb())
    {
        int startIndex = (pageNumber - 1) * pageSize;
        int totalRecordCount = -1;
        return db.UserCollection.GetAsArray(null,
                                            null,
                                            startIndex,
                                            pageSize,
                                            ref totalRecordCount);
    }
}

[VB.NET]

Public Function GetUserPage(ByVal pageNumber As Integer , _
                            ByVal pageSize As Integer) As UserRow()
    Dim db As MyDb = New MyDb()
    Try
        Dim startIndex As Integer = (pageNumber - 1) * pageSize
        Dim totalRecordCount As Integer = -1
        Return db.UserCollection.GetAsArray(Nothing , _
                                            Nothing , _
                                            startIndex, _
                                            pageSize, _
                                            totalRecordCount)
    Finally
        db.Dispose()
    End Try
End Function