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