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 ( );
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 ( ) );
}
}
Private Sub ClearDataSet ( ByVal myDataSet As DataSet )
' to test, print the number rows in each table.
Dim tbl As DataTable
For Each tbl In myDataSet.Tables
Response.Write ( tbl.TableName & "Rows.Count = " & _
tbl.Rows.Count.ToString ( ) )
Next
' clear all rows of each table.
myDataSet.Clear ( )
' print the number of rows again.
For Each tbl In myDataSet.Tables
Response.Write ( tbl.TableName & "Rows.Count = " & _
tbl.Rows.Count.ToString ( ) )
Next
End Sub |
|
C# |
VB |
DataSet Members