Edit

Share via


DataRow.GetColumnError Method

Definition

Gets the error description for a column.

Overloads

GetColumnError(String)

Gets the error description for a column, specified by name.

GetColumnError(DataColumn)

Gets the error description of the specified DataColumn.

GetColumnError(Int32)

Gets the error description for the column specified by index.

GetColumnError(String)

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

Gets the error description for a column, specified by name.

public:
 System::String ^ GetColumnError(System::String ^ columnName);
public string GetColumnError (string columnName);
member this.GetColumnError : string -> string
Public Function GetColumnError (columnName As String) As String

Parameters

columnName
String

The name of the column.

Returns

The text of the error description.

Examples

The following example sets an error description for a specified 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

Remarks

Use the SetColumnError method to set column errors.

To determine whether any errors exist for the columns collection, use the HasErrors method. Consequently, you can use the GetColumnsInError method to retrieve all the columns with errors.

To clear all errors for the columns collection, use the ClearErrors method.

See also

Applies to

GetColumnError(DataColumn)

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

Gets the error description of the specified DataColumn.

public:
 System::String ^ GetColumnError(System::Data::DataColumn ^ column);
public string GetColumnError (System.Data.DataColumn column);
member this.GetColumnError : System.Data.DataColumn -> string
Public Function GetColumnError (column As DataColumn) As String

Parameters

Returns

The text of the error description.

Examples

The following example sets an error description for a specified 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

Remarks

Use the SetColumnError method to set column errors.

To determine whether any errors exist for the columns collection, use the HasErrors method. Consequently, you can use the GetColumnsInError method to retrieve all the columns with errors. Alternatively, the GetErrors method of the DataTable returns all rows with errors.

To clear all errors for the columns collection, use the ClearErrors method.

See also

Applies to

GetColumnError(Int32)

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

Gets the error description for the column specified by index.

public:
 System::String ^ GetColumnError(int columnIndex);
public string GetColumnError (int columnIndex);
member this.GetColumnError : int -> string
Public Function GetColumnError (columnIndex As Integer) As String

Parameters

columnIndex
Int32

The zero-based index of the column.

Returns

The text of the error description.

Exceptions

The columnIndex argument is out of range.

Examples

The following example sets an error description for a specified 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

Remarks

Use the SetColumnError method to set column errors.

To determine whether any errors exist for the columns collection, use the HasErrors method. Consequently, you can use the GetColumnsInError method to retrieve all the columns with errors.

To clear all errors for the columns collection, use the ClearErrors method.

See also

Applies to