RemoveRow Method
The RemoveRow method removes a row in any state from an data table.
/// <summary>
/// Removes row from data table
/// </summary>
/// <param name="dataTable">Data table</param>
/// <param name="dataRow"<Data row to remove</param<
public static void RemoveRow(this IDataTable? dataTable, IDataRow? dataRow)
Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll
// 1. Create an empty data set and a table
IDataSet dataSet = DataSetFactory.CreateDataSet();
IDataTable employeeDataTable = dataSet.AddNewTable("Employee");
employeeDataTable.AddColumn("Id", DataTypeNames.INT32);
employeeDataTable.AddColumn("FirstName", DataTypeNames.STRING);
employeeDataTable.AddColumn("LastName", DataTypeNames.STRING);
// 2. Add a row in Added state
IDataRow employeeDataRow1 = employeeDataTable.AddNewRow();
employeeDataRow1["Id"] = 1;
employeeDataRow1["FirstName"] = "John";
employeeDataRow1["LastName"] = "Doe";
// 3. Add a row in Unchanged state
IDataRow employeeDataRow2 = employeeDataTable.AddNewRow();
employeeDataRow2["Id"] = 2;
employeeDataRow2["FirstName"] = "Sara";
employeeDataRow2["LastName"] = "Gor";
employeeDataRow2.AcceptChanges();
// 3. Add a row in Modified state
IDataRow employeeDataRow3 = employeeDataTable.AddNewRow();
employeeDataRow3["Id"] = 1;
employeeDataRow3["FirstName"] = "Paul";
employeeDataRow3["LastName"] = "Carry";
employeeDataRow3.AcceptChanges();
employeeDataRow3["FirstName"] = "Tom";
// 4. Call RemoveRow on each row
// Added row removed from table
employeeDataTable.RemoveRow(employeeDataRow1);
// Unchanged row removed from table
employeeDataTable.RemoveRow(employeeDataRow2);
// Modified row removed from table
employeeDataTable.RemoveRow(employeeDataRow3);
Table of Content POCO DataSet API References POCO DataSet Types DataTable Members
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.