The DataTable Class

Chia sẻ: Tuan Nghia | Ngày: | Loại File: PDF | Số trang:3

0
51
lượt xem
9
download

The DataTable Class

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

The DataTable Class You use an object of the DataTable class to represent a table. You can also store multiple DataTable objects in a DataSet. Table 11.1 shows some of the DataTable properties.

Chủ đề:
Lưu

Nội dung Text: The DataTable Class

  1. The DataTable Class You use an object of the DataTable class to represent a table. You can also store multiple DataTable objects in a DataSet. Table 11.1 shows some of the DataTable properties. Table 11.1: DataTable PROPERTIES PROPERTY TYPE DESCRIPTION CaseSensitive bool Gets or sets a bool value that indicates whether string comparisons within DataTable objects are case-sensitive. 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. Columns DataColumnCollection Gets the collection of columns (DataColumnCollection) that contains DataColumn objects that represent the columns in the DataTable object. Constraints ConstraintCollection Gets the collection of constraints (ConstraintCollection) that contains Constraint objects that represent primary key (UniqueConstraint) or foreign key constraints (ForeignKeyConstraint) in the DataTable object. DataSet DataSet Gets the DataSet to which the DataTable belongs. HasErrors bool Returns a bool value that indicates whether any of the rows in the DataTable have errors. PrimaryKey DataColumn[] Gets or sets an array of DataColumn objects that are the primary keys for the DataTable. Rows DataRowCollection Gets the collection of rows (DataRowCollection) that contains the DataRow objects stored in the DataTable. TableName string Gets or sets the name of the DataTable object. Table 11.2 shows some of the DataTable methods. Table 11.2: DataTable METHODS
  2. METHOD RETURN DESCRIPTION TYPE AcceptChanges() void Commits all the changes made to the DataTable object since it was loaded or since the last time the AcceptChanges() method was called. Clear() void Removes all rows from the DataTable object. Clone() DataTable Clones the structure of the DataTable object and returns that clone. Compute() object Computes the given expression on the current rows that pass the filter criteria. GetChanges() DataTable Overloaded. Returns a copy of the DataTable object since it was last loaded or since the last time the AcceptChanges() method was called. GetErrors() DataRow[] Overloaded. Gets a copy of all the DataRow objects that have errors. LoadDataRow() DataRow Finds and updates a specified DataRow object. If no matching object is found, a new row is created using the specified values. NewRow() DataRow Creates a new DataRow object in the DataTable. RejectChanges() void Undoes all the changes made to the DataTable object since it was created or since the last time the AcceptChanges() method was called. Select() DataRow[] Overloaded. Returns the array of DataRow objects stored in the DataTable that match the specified filter string. You can also pass a string containing details on how to sort the DataRow objects. Table 11.3 shows some of the DataTable events. Table 11.3: DataTable EVENTS EVENT EVENT HANDLER DESCRIPTION ColumnChanging DataColumnChangeEventHandler Fires before a changed DataColumn value is committed in a DataRow. ColumnChanged DataColumnChangeEventHandler Fires after a changed DataColumn value is committed in a DataRow. RowChanging DataRowChangeEventHandler Fires before a changed DataRow is committed in a DataTable.
  3. Table 11.3: DataTable EVENTS EVENT EVENT HANDLER DESCRIPTION RowChanged DataRowChangeEventHandler Fires after a changed DataRow is committed in a DataTable. RowDeleting DataRowChangeEventHandler Fires before a DataRow is deleted from a DataTable. RowDeleted DataRowChangeEventHandler Fires after a DataRow is deleted from a DataTable.
Đồng bộ tài khoản