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(MagentoConnection adobe commerceConnection, int StartRow, int PageLength)
{
MagentoCommand adobe commerceCommand = new MagentoCommand("SELECT customer_id, firstname, lastname FROM Customers", adobe commerceConnection);
adobe commerceConnection.Open();
MagentoDataReader adobe commerceReader = adobe commerceCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (adobe commerceReader.Read())
{
Console.WriteLine(adobe commerceReader.GetInt32(0).ToString() + ", " + adobe commerceReader.GetString(1) + ", " + adobe commerceReader.GetString(2));
}
}
finally
{
adobe commerceReader.Close();
adobe commerceConnection.Close();
}
} |
|
|---|
Public Sub ExecutePaged(ByVal adobe commerceConnection As MagentoConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim adobe commerceCommand As New MagentoCommand("SELECT customer_id, firstname, lastname FROM Customers", adobe commerceConnection)
adobe commerceConnection.Open()
Dim adobe commerceReader As MagentoDataReader = adobe commerceCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While adobe commerceReader.Read()
Console.WriteLine(adobe commerceReader.GetInt32(0).ToString() + ", " _
+ adobe commerceReader.GetString(1) + ", " _
+ adobe commerceReader.GetString(2))
End While
Finally
adobe commerceReader.Close()
adobe commerceConnection.Close()
End Try
End Sub |