asp.net.ph

DataTable.Clear Method

System.Data Namespace   DataTable Class


Clears the DataTable of all data.

[ VB ]
Public Sub Clear ( )

[ C# ]
public void Clear ( );

[ C++ ]
public: void Clear ( );

[ JScript ]
public function Clear ( );

Remarks

All rows in all tables are removed. An exception is generated if the table has any enforced child relations that would cause child rows to be stranded.

Example

The following example clears the table of all data.

Private void ClearTable ( DataTable myTable ) {
   try {
      myTable.Clear ( );
  }
   catch ( DataException dataException ) {
      Response.Write ( dataException.ToString ( ) );
   }
}
  C# VB

See Also

DataTable Members Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note