DataRow.SetColumnError 메서드

정의

열에 대한 오류 설명을 설정합니다.

오버로드

SetColumnError(DataColumn, String)

DataColumn으로 지정된 열에 대한 오류 설명을 설정합니다.

SetColumnError(Int32, String)

지정된 인덱스를 가진 열에 대한 오류 설명을 설정합니다.

SetColumnError(String, String)

지정된 이름을 가진 열에 대한 오류 설명을 설정합니다.

SetColumnError(DataColumn, String)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

DataColumn으로 지정된 열에 대한 오류 설명을 설정합니다.

public:
 void SetColumnError(System::Data::DataColumn ^ column, System::String ^ error);
public void SetColumnError (System.Data.DataColumn column, string? error);
public void SetColumnError (System.Data.DataColumn column, string error);
member this.SetColumnError : System.Data.DataColumn * string -> unit
Public Sub SetColumnError (column As DataColumn, error As String)

매개 변수

column
DataColumn

오류 설명을 설정할 DataColumn입니다.

error
String

오류 설명입니다.

예제

다음 예제에서는 지정된 DataRow에 대한 오류 설명을 설정합니다.

private void SetColError(DataRow row, int columnIndex)
{
    string errorString = "Replace this text.";

    // Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString);
}

private void PrintColError(DataRow row, int columnIndex)
{
    // Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
    byVal columnIndex As Integer)
    Dim errorString As String = "Replace this text."

    ' Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString)
End Sub
 
Private Sub PrintColError( _
    ByVal row As DataRow, byVal columnIndex As Integer)

    ' Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex))
End Sub

설명

오류 설명을 검사하려면 메서드를 GetColumnError 사용합니다.

열 컬렉션에 대한 오류가 있는지 여부를 확인하려면 속성을 사용합니다 HasErrors . 따라서 메서드를 GetColumnsInError 사용하여 오류가 있는 모든 열을 검색할 수 있습니다.

또는 빈 문자열이 매개 변수 DataRowerror 전달되면 null 는 오류가 설정되지 않은 것처럼 동작하고 속성은 false를 HasErrors 반환합니다.

전체 행에서 사용자 지정 오류 설명을 설정하려면 속성을 사용합니다 RowError .

열 컬렉션에 대한 오류가 있는지 확인하려면 메서드를 HasErrors 사용합니다.

열 컬렉션에 대한 모든 오류를 지우려면 메서드를 ClearErrors 사용합니다.

추가 정보

적용 대상

SetColumnError(Int32, String)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

지정된 인덱스를 가진 열에 대한 오류 설명을 설정합니다.

public:
 void SetColumnError(int columnIndex, System::String ^ error);
public void SetColumnError (int columnIndex, string? error);
public void SetColumnError (int columnIndex, string error);
member this.SetColumnError : int * string -> unit
Public Sub SetColumnError (columnIndex As Integer, error As String)

매개 변수

columnIndex
Int32

열의 인덱스(0부터 시작)입니다.

error
String

오류 설명입니다.

예외

columnIndex 인수가 범위를 벗어난 경우

예제

다음 예제에서는 지정된 DataRow에 대한 오류 설명을 설정합니다.

private void SetColError(DataRow row, int columnIndex)
{
    string errorString = "Replace this text.";

    // Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString);
}

private void PrintColError(DataRow row, int columnIndex)
{
    // Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
    byVal columnIndex As Integer)
    Dim errorString As String = "Replace this text."

    ' Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString)
End Sub
 
Private Sub PrintColError( _
    ByVal row As DataRow, byVal columnIndex As Integer)

    ' Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex))
End Sub

설명

메서드는 지정된 열에 대한 사용자 지정 오류 설명을 설정하는 데 사용됩니다. 컨트롤을 ErrorProvider 사용하여 오류 텍스트를 표시할 수 있습니다.

오류 설명을 검사하려면 메서드를 GetColumnError 사용합니다.

열 컬렉션에 대한 오류가 있는지 여부를 확인하려면 속성을 사용합니다 HasErrors . 따라서 메서드를 GetColumnsInError 사용하여 오류가 있는 모든 열을 검색할 수 있습니다.

또는 빈 문자열이 매개 변수 DataRowerror 전달되면 null 는 오류가 설정되지 않은 것처럼 동작하고 속성은 false를 HasErrors 반환합니다.

전체 행에서 사용자 지정 오류 설명을 설정하려면 속성을 사용합니다 RowError .

열 컬렉션에 대한 모든 오류를 지우려면 메서드를 ClearErrors 사용합니다.

전체 행에 적용되는 오류 텍스트를 설정하려면 속성을 설정합니다 RowError .

추가 정보

적용 대상

SetColumnError(String, String)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

지정된 이름을 가진 열에 대한 오류 설명을 설정합니다.

public:
 void SetColumnError(System::String ^ columnName, System::String ^ error);
public void SetColumnError (string columnName, string? error);
public void SetColumnError (string columnName, string error);
member this.SetColumnError : string * string -> unit
Public Sub SetColumnError (columnName As String, error As String)

매개 변수

columnName
String

열 이름입니다.

error
String

오류 설명입니다.

예제

다음 예제에서는 지정된 DataRow에 대한 오류 설명을 설정합니다.

private void SetColError(DataRow row, int columnIndex)
{
    string errorString = "Replace this text.";

    // Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString);
}

private void PrintColError(DataRow row, int columnIndex)
{
    // Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
    byVal columnIndex As Integer)
    Dim errorString As String = "Replace this text."

    ' Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString)
End Sub
 
Private Sub PrintColError( _
    ByVal row As DataRow, byVal columnIndex As Integer)

    ' Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex))
End Sub

설명

열의 이름은 클래스의 속성을 사용하여 ColumnName 설정됩니다 DataColumn .

오류 설명을 검사하려면 메서드를 GetColumnError 사용합니다.

열 컬렉션에 대한 오류가 있는지 여부를 확인하려면 속성을 사용합니다 HasErrors . 따라서 메서드를 GetColumnsInError 사용하여 오류가 있는 모든 열을 검색할 수 있습니다.

또는 빈 문자열이 매개 변수 DataRowerror 전달되면 null 는 오류가 설정되지 않은 것처럼 동작하고 속성은 false를 HasErrors 반환합니다.

전체 행에서 사용자 지정 오류 설명을 설정하려면 속성을 사용합니다 RowError .

열 컬렉션에 대한 오류가 있는지 확인하려면 메서드를 HasErrors 사용합니다.

열 컬렉션에 대한 모든 오류를 지우려면 메서드를 ClearErrors 사용합니다.

추가 정보

적용 대상