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(SnowflakeConnection snowflakeConnection, int StartRow, int PageLength)
{
SnowflakeCommand snowflakeCommand = new SnowflakeCommand("SELECT id, first_name, last_name FROM your_database.your_schema.employees", snowflakeConnection);
snowflakeConnection.Open();
SnowflakeDataReader snowflakeReader = (SnowflakeDataReader)snowflakeCommand.ExecutePageReader(System.Data.CommandBehavior.Default,StartRow,PageLength);
try
{
while (snowflakeReader.Read())
{
Console.WriteLine(snowflakeReader.GetInt64(0) + ", " + snowflakeReader.GetString(1) + ", " + snowflakeReader.GetString(2));
}
}
finally
{
snowflakeReader.Close();
snowflakeConnection.Close();
}
} |
|
|---|
Public Sub ExecutePaged(ByVal snowflakeConnection As SnowflakeConnection, ByVal StartRow As Integer, ByVal PageLength As Integer)
Dim snowflakeCommand As New SnowflakeCommand("SELECT id, first_name, last_name FROM your_database.your_schema.employees", snowflakeConnection)
snowflakeConnection.Open()
Dim snowflakeReader As SnowflakeDataReader = snowflakeCommand.ExecutePageReader(System.Data.CommandBehavior.Default, StartRow, PageLength)
Try
While snowflakeReader.Read()
Console.WriteLine(snowflakeReader.GetInt64(0) + ", " _
+ snowflakeReader.GetString(1) + ", " _
+ snowflakeReader.GetString(2))
End While
Finally
snowflakeReader.Close()
snowflakeConnection.Close()
End Try
End Sub |