다음을 통해 공유


DataRow.EndEdit 메서드

행에서 수행 중인 편집을 끝냅니다.

네임스페이스: System.Data
어셈블리: System.Data(system.data.dll)

구문

‘선언
Public Sub EndEdit
‘사용 방법
Dim instance As DataRow

instance.EndEdit
public void EndEdit ()
public:
void EndEdit ()
public void EndEdit ()
public function EndEdit ()

예외

예외 형식 조건

InRowChangingEventException

RowChanging 이벤트 내부에서 메서드를 호출한 경우

ConstraintException

제약 조건을 위반하여 편집한 경우

ReadOnlyException

행이 테이블에 속해 있으며 편집 중에 읽기 전용 열의 값을 변경하려고 한 경우

NoNullAllowedException

편집 중에 AllowDBNull이 false인 열에 null 값을 지정하려고 한 경우

설명

속성을 설정할 때 RowChanging 이벤트에 예외가 발생하면 예외가 생성됩니다.

예제

다음 예제에서는 DataGrid 컨트롤의 마지막 행에서 한 열의 값을 편집합니다. 이 예제에서는 BeginEdit 메서드와 EndEdit 메서드를 사용하여 열의 값을 편집하고 행의 변경 내용을 커밋합니다.

 Private Sub AcceptOrReject(ByVal row As DataRow)
    ' Use a function to validate the row's values.
    ' If the function returns true, end the edit; 
    ' otherwise cancel it.
    If ValidateRow(row) Then
       row.EndEdit()
    Else
       row.CancelEdit()
    End If
End Sub
 
Private Function ValidateRow(ByVal row As DataRow) As Boolean
    Dim isValid As Boolean
    ' Insert code to validate the row values. 
    ' Set the isValid variable.
    ValidateRow = isValid
End Function
private void AcceptOrReject(DataRow row)
{
    // Use a function to validate the row's values.
    // If the function returns true, end the edit;
    // otherwise cancel it.
    if(ValidateRow(row))
        row.EndEdit();
    else
        row.CancelEdit();
}
 
private bool ValidateRow(DataRow thisRow)
{
    bool isValid = true; 
    // Insert code to validate the row values. 
    // Set the isValid variable.
    return isValid;
}

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

DataRow 클래스
DataRow 멤버
System.Data 네임스페이스
AcceptChanges
DataColumn.AllowDBNull 속성
BeginEdit
CancelEdit
HasVersion
Item
RowState