System.Data Namespace DataRow Class
Returns the error description for a column specified by name.
[ VB ]
Overloads Public Function GetColumnError ( _
ByVal columnName As String _
) As String
[ C# ]
public string GetColumnError (
string columnName
);
[ C++ ]
public: String* GetColumnError (
String* columnName
);
[ JScript ]
public function GetColumnError (
columnName : String
) : String;
- columnName
- The name of the column.
The text of the error description.
Use the SetColumnError method to set column errors.
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. 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 and gets an error description for a specified DataRow, using this constructor.
private void SetColError ( DataRow myRow, string columnName ) {
string errorString;
errorString = "Your error text here.";
// set the error for the specified column of the row.
myRow.SetColumnError ( columnName, errorString );
}
private void PrintColError ( DataRow myRow, string columnName ) {
// print the error of a specified column.
Response.Write ( myRow.GetColumnError ( columnName ) );
}
Private Sub SetColError ( ByVal myRow As DataRow, ByVal columnName As String )
Dim errorString As String
errorString = "Your error text here."
' set the error for the specified column of the row.
myRow.SetColumnError ( columnName, errorString )
End Sub
Private Sub PrintColError ( ByVal myRow As DataRow, ByVal columnName As String )
' print the error of a specified column.
Response.Write ( myRow.GetColumnError ( columnName ) )
End Sub |
|
C# |
VB |
DataRow Members DataRow.GetColumnError Overload List ClearErrors ColumnsCollection Contains DataColumn GetColumnsInError HasErrors RowError SetColumnError