-->

22 February 2020

ADO.NET DataRow

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

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

Here some of the DataRow properties:

Sr.No Property Type Description
1) Table DataTable Gets the DataTable object to which the DataRow belongs.
2) RowState DataRowState Gets the current state of the DataRow. The state can be Added, Deleted, Detached (the row has been created but isn’t part of a DataRowCollection object; a DataRow is in this state immediately after it has been created and before it is added to a collection, or if it has been removed from a collection), Modified, or Unchanged. The state depends in the operation performed on the DataRow and whether the AcceptChanges() method has been called to commit the changes.
3) ItemArray object[] Gets or sets all the DataColumn objects in the DataRow.
4) HasErrors bool Returns a bool value that indicates whether any of the DataColumn objects in the DataRow have errors.

Here some of the DataRow 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) BeginEdit() void Starts an edit for the DataRow object.
3) CancelEdit() void Cancels an edit for the DataRow object.
4) ClearErrors() void Clears any errors for the DataRow object.
5) Delete() void Deletes the DataRow object.
6) EndEdit() void Stops an edit for the DataRow object.
7) GetChildRows() DataRow[] Returns an array of DataRow objects that contain the child rows using the specified DataRelation object.
8) GetColumnError() string Returns the description of the error for the specified DataColumn object.
9) GetColumnsInError() DataColumn[] Returns an array of DataColumn objects that have errors.
10) GetParentRow() DataRow Returns a DataRow object that contains the parent row using the specified DataRelation object.
11) GetParentRows() DataRow[] Returns an array of DataRow objects that contain the parent rows using the specified DataRelation object.
12) IsNull() bool Returns a bool value that indicates whether the specified DataColumn object contains a null value.
13) RejectChanges() void Undoes all changes made to the DataRow object since the AcceptChanges() method was called.
14) SetNull() void Sets the specified DataColumn object to a null value.
15) SetParentRow() void Sets the parent row to the specified DataRow object.
logoblog

Thanks for reading ADO.NET DataRow

Previous
« Prev Post

No comments:

Post a Comment

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