-->

22 February 2020

ADO.NET DataTable

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

 In this post we are exploring more about DataTable class. We use an object of the DataTable class to represent a table. We can store multiple DataTable objects in a DataSet.

Here some of the DataTable properties:

Sr.No Property Type Description
1) CaseSensitive bool Gets or sets a bool value that indicates whether string comparisons within DataTable objects are case sensitive.
2) ChildRelations DataRelationCollection Gets the collection of relations (DataRelationCollection) that allows navigation from a parent table to a child table. A DataRelationCollection consists of DataRelation objects.
3) Columns DataColumnCollection Gets the collection of columns that contains DataColumn objects that represent the columns in the DataTable object.
4) Constraints ConstraintCollection Gets the collection of constraints that contains Constraint objects that represent primary key or foreign key constraints in the DataTable object.
5) DataSet DataSet Gets the DataSet to which the DataTable belongs.
6) HasErrors bool Returns a bool value that indicates whether any of the rows in the DataTable has errors.
7) PrimaryKey DataColumn[] Gets or sets an array of DataColumn objects that are the primary keys for the DataTable.
8) Rows DataRowCollection Gets the collection of rows that contains the DataRow objects stored in the DataTable.
9) TableName string Gets the name of the DataTable object.

Here some of the DataTable Methods:

Sr.No Method Return Type Description
1) AcceptChanges() void Commits all the changes made to the DataSet object since it was loaded or since the last time the AcceptChanges() method was called.
2) Clear() void Removes all rows from all tables in the DataSet object.
3) Clone() DataSet Clones the structure of the DataSet object and returns that clone. The clone contains all the schemas, relations, and constraints.
4) GetChanges() DataSet Gets a copy of all the changes made to the DataSet object since it was last loaded or since the last time the AcceptChanges() method was called.
5) Clone() DataTable Clones the structure of the DataTable object and returns that clone.
6) Compute() object Computes the given expression on the current rows that pass the filter criteria.
7) GetErrors() DataRow[] Gets a copy of all the DataRow objects that have errors.
8) LoadDataRow() DataRow Finds and updates a specified DataRow object. If no matching DataRow object is found, a new row is created using the specified values
9) NewRow() DataRow Creates a new DataRow object in the DataTable.
10) Select() DataRow[] Returns the array of DataRow objects stored in the DataTable that match the specified criteria.
11) RejectChanges() void Undoes all the changes made to the DataSet object since it was created or since the last time the AcceptChanges() method was called.
logoblog

Thanks for reading ADO.NET DataTable

Previous
« Prev Post

No comments:

Post a Comment

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