DataTable.GetChanges メソッド
前回 DataTable を読み込むか、 AcceptChanges を呼び出した以降にこのテーブルに対して行われたすべての変更が格納されているこのテーブルのコピーを取得します。
オーバーロードの一覧
前回 DataTable を読み込むか、 AcceptChanges を呼び出した以降にこのテーブルに対して行われたすべての変更が格納されているこのテーブルのコピーを取得します。
[Visual Basic] Overloads Public Function GetChanges() As DataTable
前回 DataTable を読み込むか、 AcceptChanges を呼び出した以降にこのテーブルに対して行われたすべての変更が格納されているこのテーブルのコピーを、 DataRowState によってフィルタ処理した後で取得します。
[Visual Basic] Overloads Public Function GetChanges(DataRowState) As DataTable
[JScript] public function GetChanges(DataRowState) : DataTable;
使用例
[Visual Basic, C#, C++] メモ ここでは、GetChanges のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Private Sub ProcessDeletes(myDataTable As DataTable, myDataAdapter As OleDbDataAdapter)
Dim xDataTable As DataTable = myDataTable.GetChanges(DataRowState.Deleted)
' Check the DataTable for errors.
If xDataTable.HasErrors Then
' Insert code to resolve errors.
End If
' After fixing errors, update the database with the DataAdapter
myDataAdapter.Update(xDataTable)
End Sub
[C#]
private void ProcessDeletes(DataTable myDataTable, OleDbDataAdapter myDataAdapter)
{
DataTable xDataTable = myDataTable.GetChanges(DataRowState.Deleted);
// Check the DataTable for errors.
if (xDataTable.HasErrors)
{
// Insert code to resolve errors.
}
// After fixing errors, update the database with the DataAdapter
myDataAdapter.Update(xDataTable);
}
[C++]
private:
void ProcessDeletes(DataTable* myDataTable, OleDbDataAdapter* myDataAdapter)
{
DataTable* xDataTable;
// Check the DataTable for errors.
xDataTable = myDataTable->GetChanges(DataRowState::Deleted);
if (xDataTable->HasErrors)
{
// Insert code to resolve errors.
}
// After fixing errors, update the database with the DataAdapter
myDataAdapter->Update(xDataTable);
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。