Query Expression Syntax Examples: Partitioning (LINQ to DataSet)

 

The examples in this topic demonstrate how to use the Skip<TSource> and Take<TSource> methods to query a DataSet using the query expression syntax.

The FillDataSet method used in these examples is specified in Loading Data Into a DataSet.

The examples in this topic use the Contact, Address, Product, SalesOrderHeader, and SalesOrderDetail tables in the AdventureWorks sample database.

The examples in this topic use the following using/Imports statements:

[!CODE [DP LINQ to DataSet Examples#ImportsUsing](../CodeSnippet/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples#importsusing)]

For more information, see How to: Create a LINQ to DataSet Project In Visual Studio.

Example

This example uses the Skip<TSource> method to get all but the first two addresses in Seattle.

[!CODE [DP LINQ to DataSet Examples#SkipNested](../CodeSnippet/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples#skipnested)]

Example

This example uses the Take<TSource> method to get the first three addresses in Seattle.

[!CODE [DP LINQ to DataSet Examples#TakeNested](../CodeSnippet/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples#takenested)]

Loading Data Into a DataSet
LINQ to DataSet Examples
Standard Query Operators Overview

Show: