-->

22 February 2020

ADO.NET DataView

  Asp.Net CS By Example       22 February 2020
 ADO.NET DataView 

 In this post we are exploring more about DataView class. We use an object of the DataView class to view only specific rows in a DataTable object using a filter. We can store multiple DataView objects in a DataSet.

Here some of the DataView properties:

Sr.No Property Type Description
1) AllowDelete bool Gets or sets a bool value that indicates whether deletion of rows from the DataView object is permitted.
2) AllowEdit bool Gets or sets a bool value that indicates whether editing of rows in the DataView object is permitted.
3) AllowNew bool Gets or sets a bool value that indicates whether adding of new rows to the DataView object is permitted.
4) ApplyDefaultSort bool Gets or sets a bool value that indicates whether to use the default sorting algorithm to sort rows in the DataView object.
5) Count int Gets the number of rows in the DataView object after the rows have been filtered using a RowFilter or RowStateFilter object.
6) RowFilter string Gets or sets the expression used to filter rows in the DataView object.
7) RowStateFilter DataViewRowSet Gets or sets the expression used to filter rows based on the row state.
8) Sort string Gets or sets the sort column or columns, and sort order for the table. The string contains the column names followed by "ASC" (for ascending sort) or "DESC" (for descending sort). Columns are sorted ascending by default. Multiple columns are be separated by commas in the string.
9) Table DataTable Gets or sets the DataTable object.

Here some of the DataView Methods:

Sr.No Methods Return Type Description
1) AddNew() DataViewRow Adds a new row to the DataView object.
2) Delete() void Deletes a row at the specified index of the DataView object.
3) Find() int Finds and returns the index of a row with the specified primary key in the DataView object. The int returned by this method is the index of row if the row was found; otherwise null is returned.
4) GetEnumerator() IEnumerator Returns an enumerator for the DataView object.
5) Delete() void Deletes the row at the specified index of the DataView object.
logoblog

Thanks for reading ADO.NET DataView

Previous
« Prev Post

No comments:

Post a Comment

Please do not enter any spam link in the comment box.