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(ZohoBooksConnection ZohoBooksConnection, int StartRow, int PageLength)
{
ZohoBooksCommand ZohoBooksCommand = new ZohoBooksCommand("SELECT AccountID, \"Account Name\", Phone FROM Accounts", ZohoBooksConnection);
ZohoBooksConnection.Open();
ZohoBooksDataReader ZohoBooksReader = ZohoBooksCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (ZohoBooksReader.Read())
{
Console.WriteLine(ZohoBooksReader.GetString(0) + ", " + ZohoBooksReader.GetString(1) + ", " + ZohoBooksReader.GetString(2));
}
}
finally
{
ZohoBooksReader.Close();
ZohoBooksConnection.Close();
}
}
Public Sub ExecutePaged(ByVal ZohoBooksConnection As ZohoBooksConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim ZohoBooksCommand As New ZohoBooksCommand("SELECT AccountID, \"Account Name\", Phone FROM Accounts", ZohoBooksConnection)
ZohoBooksConnection.Open()
Dim ZohoBooksReader As ZohoBooksDataReader = ZohoBooksCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While ZohoBooksReader.Read()
Console.WriteLine(ZohoBooksReader.GetString(0) + ", " _
+ ZohoBooksReader.GetString(1) + ", " _
+ ZohoBooksReader.GetString(2))
End While
Finally
ZohoBooksReader.Close()
ZohoBooksConnection.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