DataTable.GetChanges 메서드

정의

마지막으로 로드되거나 DataTable가 호출된 후에 변경된 내용이 모두 들어 있는 AcceptChanges()의 복사본을 가져옵니다.

오버로드

GetChanges()

로드되거나 DataTable가 마지막으로 호출된 후에 변경된 내용이 모두 들어 있는 AcceptChanges()의 복사본을 가져옵니다.

GetChanges(DataRowState)

마지막으로 로드되거나 DataTable가 호출된 후에 변경되어 AcceptChanges()를 기준으로 필터링된 내용이 모두 들어 있는 DataRowState의 복사본을 가져옵니다.

GetChanges()

Source:
DataTable.cs
Source:
DataTable.cs
Source:
DataTable.cs

로드되거나 DataTable가 마지막으로 호출된 후에 변경된 내용이 모두 들어 있는 AcceptChanges()의 복사본을 가져옵니다.

public:
 System::Data::DataTable ^ GetChanges();
public System.Data.DataTable? GetChanges ();
public System.Data.DataTable GetChanges ();
member this.GetChanges : unit -> System.Data.DataTable
Public Function GetChanges () As DataTable

반환

DataTable의 변경 내용의 복사본을 반환하거나, 변경 내용이 없으면 null을 반환합니다.

예제

private void UpdateDataTable(DataTable table,
    OleDbDataAdapter myDataAdapter)
{
    DataTable xDataTable = table.GetChanges();

    // 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);
}
Private Sub UpdateDataTable(table As DataTable, _
    myDataAdapter As OleDbDataAdapter)

    Dim xDataTable As DataTable = table.GetChanges()

    ' 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

설명

보류 중인 변경 내용이 있는 원본 DataSet 의 모든 행 복사본을 포함하는 새 DataSet 을 만듭니다. 변경되지 않은 행에 변경된 행의 외설 키에 해당하는 기본 키가 포함된 경우 관계 제약 조건으로 인해 변경되지 않은 추가 행이 새 DataSet 행에 추가될 수 있습니다. 메서드는 보류 중인 변경 내용이 있는 원본 DataSet 에 행이 없으면 (NothingVisual Basic의 경우)를 반환 null 합니다.

추가 정보

적용 대상

GetChanges(DataRowState)

Source:
DataTable.cs
Source:
DataTable.cs
Source:
DataTable.cs

마지막으로 로드되거나 DataTable가 호출된 후에 변경되어 AcceptChanges()를 기준으로 필터링된 내용이 모두 들어 있는 DataRowState의 복사본을 가져옵니다.

public:
 System::Data::DataTable ^ GetChanges(System::Data::DataRowState rowStates);
public System.Data.DataTable? GetChanges (System.Data.DataRowState rowStates);
public System.Data.DataTable GetChanges (System.Data.DataRowState rowStates);
member this.GetChanges : System.Data.DataRowState -> System.Data.DataTable
Public Function GetChanges (rowStates As DataRowState) As DataTable

매개 변수

rowStates
DataRowState

DataRowState 값 중 하나입니다.

반환

작업을 수행한 다음 DataTable를 사용하여 다시 DataTable에 병합할 수 있는 경우 Merge(DataSet)의 필터링된 복사본을 반환합니다. 원하는 DataRowState 행이 없으면 이 메서드는 null을 반환합니다.

예제

private void ProcessDeletes(DataTable table,
    OleDbDataAdapter adapter)
{
    DataTable changeTable = table.GetChanges(DataRowState.Deleted);

    // Check the DataTable for errors.
    if (changeTable.HasErrors)
    {
        // Insert code to resolve errors.
    }

    // After fixing errors, update the database with the DataAdapter
    adapter.Update(changeTable);
}
Private Sub ProcessDeletes(table As DataTable, _
    adapter As OleDbDataAdapter)

   Dim changeTable As DataTable = table.GetChanges(DataRowState.Deleted)

   ' Check the DataTable for errors.
   If table.HasErrors Then
      ' Insert code to resolve errors.
   End If

   ' After fixing errors, update the database with the DataAdapter 
   adapter.Update(changeTable)
End Sub

설명

메서드는 GetChanges 원래에 도입된 변경 내용만 포함하는 두 번째 DataTable 개체를 생성하는 데 사용됩니다. 인수를 rowStates 사용하여 새 개체에 포함해야 하는 변경 내용의 형식을 지정합니다.

관계 제약 조건으로 인해 변경되지 않은 부모 행이 포함될 수 있습니다.

추가 정보

적용 대상