Returns a specific subset of rows when paging through the results of a query.
The example below shows how to retrieve a part of a table. If this function is called with parameters
startRecord=2 and
maxRecords=3, it returns 3 rows: second, third, and fourth.
public void ExecutePaged(FreshBooksConnection freshbooksConnection, int StartRow, int PageLength)
{
FreshBooksCommand freshbooksCommand = new FreshBooksCommand("SELECT Id, FirstName, LastName FROM Client", freshbooksConnection);
freshbooksConnection.Open();
FreshBooksDataReader freshbooksReader = freshbooksCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (freshbooksReader.Read())
{
Console.WriteLine(freshbooksReader.GetString(0) + ", " + freshbooksReader.GetString(1) + ", " + freshbooksReader.GetString(2));
}
}
finally
{
freshbooksReader.Close();
freshbooksConnection.Close();
}
}
Public Sub ExecutePaged(ByVal freshbooksConnection As FreshBooksConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim freshbooksCommand As New FreshBooksCommand("SELECT Id, FirstName, LastName FROM Client", freshbooksConnection)
freshbooksConnection.Open()
Dim freshbooksReader As FreshBooksDataReader = freshbooksCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While freshbooksReader.Read()
Console.WriteLine(freshbooksReader.GetString(0) + ", " _
+ freshbooksReader.GetString(1) + ", " _
+ freshbooksReader.GetString(2))
End While
Finally
freshbooksReader.Close()
freshbooksConnection.Close()
End Try
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2