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(ExactTargetConnection exactTargetConnection, int StartRow, int PageLength)
{
ExactTargetCommand exactTargetCommand = new ExactTargetCommand("SELECT ID, Name, Subject FROM Email", exactTargetConnection);
exactTargetConnection.Open();
ExactTargetDataReader exactTargetReader = exactTargetCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (exactTargetReader.Read())
{
Console.WriteLine(exactTargetReader.GetInt32(0).ToString() + ", " + exactTargetReader.GetString(1) + ", " + exactTargetReader.GetString(2));
}
}
finally
{
exactTargetReader.Close();
exactTargetConnection.Close();
}
}
Public Sub ExecutePaged(ByVal exactTargetConnection As ExactTargetConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim exactTargetCommand As New ExactTargetCommand("SELECT ID, Name, Subject FROM Email", exactTargetConnection)
exactTargetConnection.Open()
Dim exactTargetReader As ExactTargetDataReader = exactTargetCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While exactTargetReader.Read()
Console.WriteLine(exactTargetReader.GetInt32(0).ToString() + ", " _
+ exactTargetReader.GetString(1) + ", " _
+ exactTargetReader.GetString(2))
End While
Finally
exactTargetReader.Close()
exactTargetConnection.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