Export (0) Print
Expand All

DataRow.GetColumnError Method (DataColumn)

Gets the error description of the specified DataColumn.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)

'Declaration
Public Function GetColumnError ( _
	column As DataColumn _
) As String

Parameters

column
Type: System.Data.DataColumn

A DataColumn.

Return Value

Type: System.String
The text of the error description.

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.

The following example sets an error description for a specified DataRow.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft