DataTable.RejectChanges DataTable.RejectChanges DataTable.RejectChanges DataTable.RejectChanges Method


테이블이 로드된 이후 또는 AcceptChanges()가 마지막으로 호출된 이후에 변경된 내용을 모두 롤백합니다.Rolls back all changes that have been made to the table since it was loaded, or the last time AcceptChanges() was called.

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


다음 예제에서는 몇 가지 변경 내용에는 DataTable, 하지만 호출 하 여 변경 내용을 거부를 RejectChanges 메서드.The following example makes several changes to a DataTable, but rejects the changes by invoking the RejectChanges method.

private void ShowRejectChanges(DataTable table)
    // Print the values of row 1, in the column named "CompanyName."

    // Make Changes to the column named "CompanyName."
    table.Rows[1]["CompanyName"] = "Taro";

    // Reject the changes.

    // Print the original values:
Private Sub ShowRejectChanges(table As DataTable)
    ' Print the values of row 1, in the column named "CompanyName."

    ' Make Changes to the column named "CompanyName."
    table.Rows(1)("CompanyName") = "Taro"

    ' Reject the changes.

    ' Print the original values:
End Sub


RejectChanges 가 호출 된 DataRow 아직 편집 모드에에서 있는 개체의 편집이 취소 합니다.When RejectChanges is called, any DataRow objects that are still in edit-mode cancel their edits. 새 행이 제거 됩니다.New rows are removed. 사용 하 여 행을 DataRowState 로 설정 Modified 또는 Deleted 원래 상태로 다시 반환 합니다.Rows with the DataRowState set to Modified or Deleted return back to their original state.

적용 대상

추가 정보