Basic use of DataView
What is the basic use of dataview in ado.net?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
R ACHUTHA181 reputationPosted Oct 5, 2012, 2:56 AM EDT
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
Example:
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);
refer the below link
http://www.c-sharpcorner.com/UploadFile/rohatash/ado-net-dataview-in-Asp-Net/
Kunal VaishyaRank #990 · 2K reputationPosted Oct 5, 2012, 3:43 AM EDT
main benefit of dataview to filter records and do operation on you can also convert in to table or else