DataTableCollection.Clear Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Rensar samlingen med alla DataTable objekt.
public:
void Clear();
public void Clear();
member this.Clear : unit -> unit
Public Sub Clear ()
Exempel
I följande exempel hämtas DataTableCollection en DataSet, och sedan rensas samlingen med alla tabeller.
private void ClearTables()
{
// Get the DataSet of a DataGrid control.
DataSet dataSet = (DataSet)DataGrid1.DataSource;
DataTableCollection tables = dataSet.Tables;
// Clear the collection.
tables.Clear();
}
Private Sub ClearTables()
' Get the DataSet of a DataGrid control.
Dim dataSet As DataSet = CType(DataGrid1.DataSource, DataSet)
Dim tables As DataTableCollection = dataSet.Tables
' Clear the collection.
tables.Clear
End Sub
Kommentarer
Om du vill ta bort en viss från DataTable samlingen använder du Remove metoden .