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(BigQueryConnection bigQueryConnection, int StartRow, int PageLength)
{
BigQueryCommand bigQueryCommand = new BigQueryCommand("SELECT id, first_name, last_name FROM your_project.your_dataset.employees", bigQueryConnection);
bigQueryConnection.Open();
BigQueryDataReader bigQueryReader = bigQueryCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (bigQueryReader.Read())
{
Console.WriteLine(bigQueryReader.GetInt64(0) + ", " + bigQueryReader.GetString(1) + ", " + bigQueryReader.GetString(2));
}
}
finally
{
bigQueryReader.Close();
bigQueryConnection.Close();
}
} |
|
|---|
Public Sub ExecutePaged(ByVal bigQueryConnection As BigQueryConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim bigQueryCommand As New BigQueryCommand("SELECT id, first_name, last_name FROM your_project.your_dataset.employees", bigQueryConnection)
bigQueryConnection.Open()
Dim bigQueryReader As BigQueryDataReader = bigQueryCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While bigQueryReader.Read()
Console.WriteLine(bigQueryReader.GetInt64(0) + ", " _
+ bigQueryReader.GetString(1) + ", " _
+ bigQueryReader.GetString(2))
End While
Finally
bigQueryReader.Close()
bigQueryConnection.Close()
End Try
End Sub |