DataRowState 열거형

정의

DataRow 개체의 상태를 가져옵니다.Gets the state of a DataRow object.

이 열거형에는 멤버 값의 비트 조합을 허용하는 FlagsAttribute 특성이 있습니다.

public enum class DataRowState
[System.Flags]
public enum DataRowState
type DataRowState = 
Public Enum DataRowState
상속
DataRowState
특성

필드

Added 4

행이 DataRowCollection에 추가되었으며 AcceptChanges()는 호출되지 않았습니다.The row has been added to a DataRowCollection, and AcceptChanges() has not been called.

Deleted 8

Delete()DataRow 메서드를 사용하여 행을 삭제했습니다.The row was deleted using the Delete() method of the DataRow.

Detached 1

행이 만들어졌지만 DataRowCollection의 일부는 아닙니다.The row has been created but is not part of any DataRowCollection. DataRow는 만들어진 직후 및 컬렉션에 추가되기 전 또는 컬렉션에서 제거된 경우 이 상태가 됩니다.A DataRow is in this state immediately after it has been created and before it is added to a collection, or if it has been removed from a collection.

Modified 16

행이 수정되었으며 AcceptChanges()는 호출되지 않았습니다.The row has been modified and AcceptChanges() has not been called.

Unchanged 2

AcceptChanges()가 마지막으로 호출된 이후에 행이 변경되지 않았습니다.The row has not changed since AcceptChanges() was last called.

예제

다음 예제에서는 먼저 새로 만듭니다 DataTable 하나의 열이 있는 단일 다음 만듭니다 DataRow합니다.The following example first creates a new DataTable with one column, then creates a single DataRow. DataRow 는 생성, 추가, 수정 및 삭제, 해당 RowState 출력 됩니다.As the DataRow is created, added, modified, and deleted, its RowState is printed.

private void DemonstrateRowState() {
   //Run a function to create a DataTable with one column.
   DataTable myTable = MakeTable();
   DataRow myRow;

   // Create a new DataRow.
   myRow = myTable.NewRow();
   // Detached row.
   Console.WriteLine("New Row " + myRow.RowState);

   myTable.Rows.Add(myRow);
   // New row.
   Console.WriteLine("AddRow " + myRow.RowState);

   myTable.AcceptChanges();
   // Unchanged row.
   Console.WriteLine("AcceptChanges " + myRow.RowState);

   myRow["FirstName"] = "Scott";
   // Modified row.
   Console.WriteLine("Modified " + myRow.RowState);

   myRow.Delete();
   // Deleted row.
   Console.WriteLine("Deleted " + myRow.RowState);
}

private DataTable MakeTable(){
   // Make a simple table with one column.
   DataTable dt = new DataTable("myTable");
   DataColumn dcFirstName = new DataColumn("FirstName", Type.GetType("System.String"));
   dt.Columns.Add(dcFirstName);
   return dt;
}
Private Sub DemonstrateRowState()
    'Run a function to create a DataTable with one column.
    Dim dataTable As DataTable = MakeTable()
    Dim dataRow As DataRow

    ' Create a new DataRow.
    dataRow = dataTable.NewRow()
    ' Detached row.
    Console.WriteLine(String.Format("New Row {0}", dataRow.RowState))

    dataTable.Rows.Add(dataRow)
    ' New row.
    Console.WriteLine(String.Format("AddRow {0}", dataRow.RowState))

    dataTable.AcceptChanges()
    ' Unchanged row.
    Console.WriteLine(String.Format("AcceptChanges {0}", dataRow.RowState))

    dataRow("FirstName") = "Scott"
    ' Modified row.
    Console.WriteLine(String.Format("Modified {0}", dataRow.RowState))

    dataRow.Delete()
    ' Deleted row.
    Console.WriteLine(String.Format("Deleted {0}", dataRow.RowState))
End Sub

Private Function MakeTable() As DataTable
    ' Make a simple table with one column.
    Dim dt As New DataTable("dataTable")
    Dim firstName As New DataColumn("FirstName", _
       Type.GetType("System.String"))
    dt.Columns.Add(firstName)
    Return dt
End Function

설명

DataRowState 열거형에서 반환 되는 RowState 의 속성을 DataRow 클래스입니다.The DataRowState enumeration is returned by the RowState property of the DataRow class.

적용 대상

추가 정보