DataTableCollection.Clear 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
清除所有 DataTable 物品的集合。
public:
void Clear();
public void Clear();
member this.Clear : unit -> unit
Public Sub Clear ()
範例
以下範例取 DataTableCollection 的 DataSet,然後清除所有表的集合。
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
備註
要從集合中移除某個特定 DataTable 物件,請使用該 Remove 方法。