Datatable.getchanges 삭제 후 추가된 행은 어떻게 인식 - datatable.getchanges sagje hu chugadoen haeng-eun eotteohge insig

주요 콘텐츠로 건너뛰기

이 브라우저는 더 이상 지원되지 않습니다.

최신 기능, 보안 업데이트, 기술 지원을 이용하려면 Microsoft Edge로 업그레이드하세요.

DataTable.GetChanges 메서드

  • 참조

정의

이 문서의 내용

오버로드

GetChanges()

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

반환

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 합니다.

추가 정보

  • DataTables
  • DataTable 이벤트 처리

적용 대상

GetChanges(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.DataTablePublic Function GetChanges (rowStates As DataRowState) As DataTable

매개 변수

반환

DataTable

작업을 수행한 다음 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 사용하여 새 개체에 포함해야 하는 변경 형식을 지정합니다.

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

추가 정보

  • DataTables
  • DataTable 이벤트 처리

적용 대상

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

DataTable.GetChanges Method

  • Reference

Definition

Gets a copy of the DataTable containing all changes made to it since it was last loaded, or since AcceptChanges() was called.

In this article

Overloads

GetChanges()

Gets a copy of the DataTable that contains all changes made to it since it was loaded or AcceptChanges() was last called.

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

Returns

DataTable

A copy of the changes from this DataTable, or null if no changes are found.

Examples

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

Remarks

Creates a new DataSet containing a copy of all rows in the original DataSet that have pending changes. Relationship constraints can cause additional unchanged rows to be added to the new DataSet if the unchanged rows contain primary keys corresponding to foreign keys in the changed rows. The method returns null (Nothing in Visual Basic) if there are no rows in the original DataSet with pending changes.

See also

  • DataTables
  • Handling DataTable Events

Applies to

GetChanges(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.DataTablePublic Function GetChanges (rowStates As DataRowState) As DataTable

Parameters

Returns

DataTable

A filtered copy of the DataTable that can have actions performed on it, and later be merged back in the DataTable using Merge(DataSet). If no rows of the desired DataRowState are found, the method returns null.

Examples

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

Remarks

The GetChanges method is used to produce a second DataTable object that contains only the changes introduced into the original. Use the rowStates argument to specify the type of changes the new object should include.

Relationship constraints may cause unchanged parent rows to be included.

See also

  • DataTables
  • Handling DataTable Events

Applies to

Toplist

최신 우편물

태그