ListViewUpdatedEventArgs.AffectedRows 속성

정의

업데이트 작업의 영향을 받는 행의 수를 가져옵니다.

public:
 property int AffectedRows { int get(); };
public int AffectedRows { get; }
member this.AffectedRows : int
Public ReadOnly Property AffectedRows As Integer

속성 값

Int32

업데이트 작업의 영향을 받는 행의 수입니다.

예제

다음 예제에서는 사용 하는 방법의 AffectedRows 속성 항목이 업데이트 되었는지 확인 합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ListViewUpdatedEventArgs 클래스입니다.

void ContactsListView_ItemUpdated(Object sender, ListViewUpdatedEventArgs e)
{
    if (e.Exception != null)
    {
        if (e.AffectedRows == 0)
        {
            e.KeepInEditMode = true;
            Message.Text = "An exception occurred updating the contact. " +
                                "Please verify your values and try again.";
        }
        else
            Message.Text = "An exception occurred updating the contact. " +
                                "Please verify the values in the recently updated item.";

        e.ExceptionHandled = true;
    }
}
Sub ContactsListView_ItemUpdated(sender As Object, e As ListViewUpdatedEventArgs)
    If e.Exception IsNot Nothing Then
        If e.AffectedRows = 0 Then
            e.KeepInEditMode = True
            Message.Text = "An exception occurred updating the contact. " & _
                                "Please verify your values and try again."
        Else
            Message.Text = "An exception occurred updating the contact. " & _
                                "Please verify the values in the recently updated item."
        End If

        e.ExceptionHandled = True
    End If
End Sub

설명

사용 된 AffectedRows 속성을 데이터 원본에서 반환 된 업데이트 작업에서 영향을 받는 행의 수를 확인 합니다. 일반적으로 항목을 하나만 업데이트 되 면이 속성 값이 0 또는 1 일반적으로 포함 됩니다.

경우에 따라 업데이트 작업 중 예외가 발생 하지 않습니다는 오류가 발생할 수 있습니다. 이런 경우는 AffectedRows 항목이 업데이트 되었는지 확인 하려면 속성을 사용할 수 있습니다.

적용 대상

추가 정보