System.Data Namespace DataRow Class
Sets the error description for a column specified by name.
[ VB ]
Overloads Public Sub SetColumnError ( _
ByVal columnName As String, _
ByVal error As String _
)
[ C# ]
void SetColumnError (
string columnName,
string error
);
[ C++ ]
public: void SetColumnError (
String* columnName,
String* error
);
[ JScript ]
public function SetColumnError (
columnName : String,
error : String
);
- columnName
- The name of the column.
- error
- The error description.
The name of a column is set with the DataColumn class's ColumnName property.
To examine error descriptions, use the GetColumnError method.
To determine if any errors exist for the columns collection, use the HasErrors method. Consequently, you can use the GetColumnsInError method to retrieve all of the columns with errors.
To set a custom error description on the whole row, use the RowError property.
To clear all errors for the columns collection, use the ClearErrors method.
The following example sets an error description for a specified DataRow.
private void SetColError ( DataRow myRow, string colName ) {
string errorString = "Your error text here.";
// set the error for the specified column of the row.
myRow.SetColumnError ( colName, errorString );
}
Private Sub SetColError ( ByVal myRow As DataRow, ByVal colName As String )
Dim errorString As String = "Your error text here."
' set the error for the specified column of the row.
myRow.SetColumnError ( colName, errorString )
End Sub |
|
C# |
VB |
DataRow Members DataRow.SetColumnError Overload List GetColumnError GetColumnsInError HasErrors RowError