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(MailChimpConnection mailchimpConnection, int StartRow, int PageLength)
{
MailChimpCommand mailchimpCommand = new MailChimpCommand("SELECT Id, Name, Type FROM Folders", mailchimpConnection);
mailchimpConnection.Open();
MailChimpDataReader mailchimpReader = mailchimpCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (mailchimpReader.Read())
{
Console.WriteLine(mailchimpReader.GetInt32(0).ToString() + ", " + mailchimpReader.GetString(1) + ", " + mailchimpReader.GetString(2));
}
}
finally
{
mailchimpReader.Close();
mailchimpConnection.Close();
}
}
Public Sub ExecutePaged(ByVal mailchimpConnection As MailChimpConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim mailchimpCommand As New MailChimpCommand("SELECT Id, Name, Type FROM Folders", mailchimpConnection)
mailchimpConnection.Open()
Dim mailchimpReader As MailChimpDataReader = mailchimpCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While mailchimpReader.Read()
Console.WriteLine(mailchimpReader.GetInt32(0).ToString() + ", " _
+ mailchimpReader.GetString(1) + ", " _
+ mailchimpReader.GetString(2))
End While
Finally
mailchimpReader.Close()
mailchimpConnection.Close()
End Try
End Sub