Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataTableExtensions::AsDataView Method (DataTable^)

 

Creates and returns a LINQ-enabled DataView object.

Namespace:   System.Data
Assembly:  System.Data.DataSetExtensions (in System.Data.DataSetExtensions.dll)

public:
[ExtensionAttribute]
static DataView^ AsDataView(
	DataTable^ table
)

Parameters

table
Type: System.Data::DataTable^

The source DataTable from which the LINQ-enabled DataView is created.

Return Value

Type: System.Data::DataView^

A LINQ-enabled DataView object.

DataView enables data-binding scenarios for LINQ to DataSet and can be created from a typed or untyped DataTable, providing a default view of that table. Filtering and sorting can be set on the DataView after it has been created from a DataTable. The DataView is then bound to a UI control, such as a DataGrid or a DataGridView, providing a simple data binding model.

For more information and examples, see Creating a DataView Object (LINQ to DataSet).

The following example creates a DataView from the SalesOrderDetail table and sets it as the data source of a BindingSource object, which acts as a proxy for a DataGridView control:

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show:
© 2017 Microsoft