DataTableCollection.Clear Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menghapus koleksi semua DataTable objek.
public:
void Clear();
public void Clear ();
member this.Clear : unit -> unit
Public Sub Clear ()
Contoh
Contoh berikut mendapatkan DataTableCollection dari DataSet, lalu menghapus koleksi semua tabel.
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
Keterangan
Untuk menghapus tertentu DataTable dari koleksi, gunakan Remove metode .