DataTableCollection.Clear Metodo

Definizione

Cancella l'insieme di tutti gli DataTable oggetti.

public:
 void Clear();
public void Clear();
member this.Clear : unit -> unit
Public Sub Clear ()

Esempio

L'esempio seguente ottiene l'oggetto DataTableCollection di un DataSetoggetto e quindi cancella l'insieme di tutte le tabelle.

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

Commenti

Per rimuovere un particolare DataTable oggetto dalla raccolta, utilizzare il Remove metodo .

Si applica a