Home > DeveloperSection > Blogs > Dataview in ADO.Net

Dataview in ADO.Net

ADO.Net ADO.Net 
0 Comment(s)
 5987  View(s)
Rate this:

Dataview in ADO.Net

A Dataview enables you to create different views of the data stored in a DataTable, a capability that is often used in data-binding applications. Using a DataView, you can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.

Dataview provides a dynamic view for a datatable. Using dataview we can perform following operation:

·         Sorting the table

·         Add, modify, delete the data

·         Filtering data from table


Creating Dataview object as
Dataview dv=new Dataview();

How to use Sort property of Dataview

DataView dv = DataTable1.DefaultView;   

dv.Sort = "username, email DESC";

Filtering in Dataview
DataView dv = new DataView(datatable1,"joindate >= 01/01/2010",   DataViewRowState.CurrentRows);

Don't want to miss updates? Please click the below button!

Follow MindStick