DataRow.RowError DataRow.RowError DataRow.RowError DataRow.RowError Property

정의

행에 대한 사용자 지정 오류 설명을 가져오거나 설정합니다.Gets or sets the custom error description for a row.

public:
 property System::String ^ RowError { System::String ^ get(); void set(System::String ^ value); };
public string RowError { get; set; }
member this.RowError : string with get, set
Public Property RowError As String

속성 값

오류를 설명하는 텍스트입니다.The text describing an error.

예제

다음 예제에서는 10 개의 행에 표시 된 테이블의 오류 텍스트를 DataGrid 컨트롤입니다.The following example sets error text for ten rows of a table displayed in a DataGrid control.

   private void SetRowErrors(DataTable table)
   {
       // Set error text for ten rows. 
       for(int i = 0; i < 10; i++)
       {
           // Insert column 1 value into each error.
           table.Rows[i].RowError = "ERROR: " 
               + table.Rows[i][1];
       }
       // Get the DataSet for the table, and test it for errors.
       DataSet dataSet = table.DataSet;
       TestForErrors(dataSet);
   }

   private void TestForErrors(DataSet dataSet)
   {
       // Test for errors. If DataSet has errors, test each table.
       if(dataSet.HasErrors)
       {
           foreach(DataTable tempDataTable in dataSet.Tables)
           {
               // If the table has errors, then print them.
               if(tempDataTable.HasErrors) 
                   PrintRowErrs(tempDataTable);
           }
           // Refresh the DataGrid to see the error-marked rows.
           dataGrid1.Refresh();
       }
   }

   private void PrintRowErrs(DataTable table)
   {
       foreach(DataRow row in table.Rows)
       {
           if(row.HasErrors) 
           {
               Console.WriteLine(row.RowError);
           }
       }
   }
Private Sub SetRowErrors(ByVal table As DataTable)
    ' Set error text for ten rows. 
    Dim i As Integer
    For i = 0 to 10
        ' Insert column 1 value into each error.
        table.Rows(i).RowError = "ERROR: " & _
            table.Rows(i)(1).ToString()
    Next
    ' Get the DataSet for the table, and test it for errors.
    Dim dataSet As DataSet = table.DataSet
    TestForErrors(dataSet)
End Sub
 
Private Sub TestForErrors(ByVal dataSet As DataSet)
    ' Test for errors. If DataSet has errors, 
    ' test each table.
    If dataSet.HasErrors
        Dim tempDataTable As DataTable
        For Each tempDataTable in dataSet.Tables
            ' If the table has errors, then print them.
            If(tempDataTable.HasErrors) Then 
                PrintRowErrs(tempDataTable)
            End If
        Next
        ' Refresh the DataGrid to see the error-marked rows.
        DataGrid1.Refresh()
    End If
End Sub
 
Private Sub PrintRowErrs(ByVal table As DataTable)
    Dim row As DataRow
    For Each row in table.Rows
       If(row.HasErrors) Then
          Console.WriteLine(row.RowError)
       End If
    Next
End Sub

설명

사용 하 여는 HasErrors 속성을 먼저 확인 여부를 DataRow 오류가 포함.Uses the HasErrors property to first determine whether a DataRow contains errors.

적용 대상

추가 정보