次の方法で共有


DataRowCollection.Clear メソッド

すべての行のコレクションを消去します。

Public Sub Clear()
[C#]
public void Clear();
[C++]
public: void Clear();
[JScript]
public function Clear();

例外

例外の種類 条件
InvalidConstraintException ForeignKeyConstraintDataRowCollection に対して強制的に適用されます。

使用例

[Visual Basic, C#, C++] すべての項目の DataRowCollection を消去する例を次に示します。

 
Private Sub ClearTable(ByVal myTable As DataTable)
    Dim rc As DataRowCollection
    rc = myTable.Rows
    ' Clear all rows.
    rc.Clear
 End Sub

[C#] 
private void ClearTable(DataTable myTable){
    DataRowCollection rc; 
    rc = myTable.Rows;
    // Clear all rows.
    rc.Clear();
 }

[C++] 
private:
void ClearTable(DataTable* myTable){
    DataRowCollection* rc; 
    rc = myTable->Rows;
    // Clear all rows.
    rc->Clear();
 }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DataRowCollection クラス | DataRowCollection メンバ | System.Data 名前空間 | Add | Remove