asp.net.ph

DataSet.Clear Method

System.Data Namespace   DataSet Class


Clears the DataSet of any data by removing all rows in all tables.

[ VB ]
Public Sub Clear ( )

[ C# ]
public void Clear ( );

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

[ JScript ]
public function Clear ( );

Example

The following example clears the DataSet of all rows in all tables.

private void ClearDataSet ( DataSet myDataSet ) {
   // to test, print the number rows in each table.

   foreach ( DataTable tbl in myDataSet.Tables ) {
      Response.Write ( tbl.TableName + "Rows.Count = " +
         tbl.Rows.Count.ToString ( ) );
  }

   // clear all rows of each table.
   myDataSet.Clear ( );

   // print the number of rows again.
   foreach ( DataTable tbl in myDataSet.Tables ) {
      Response.Write ( tbl.TableName +  "Rows.Count = "  +
         tbl.Rows.Count.ToString ( ) );
   }
}
  C# VB

See Also

DataSet Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph