Export (0) Print
Expand All

DataRow.SetColumnError Method

Sets the error description for a column.

Overload List

Sets the error description for a column specified as a DataColumn.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Sub SetColumnError(DataColumn, String)
[C#] public void SetColumnError(DataColumn, string);
[C++] public: void SetColumnError(DataColumn*, String*);
[JScript] public function SetColumnError(DataColumn, String);

Sets the error description for a column specified by index.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Sub SetColumnError(Integer, String)
[C#] public void SetColumnError(int, string);
[C++] public: void SetColumnError(int, String*);
[JScript] public function SetColumnError(int, String);

Sets the error description for a column specified by name.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Sub SetColumnError(String, String)
[C#] public void SetColumnError(string, string);
[C++] public: void SetColumnError(String*, String*);
[JScript] public function SetColumnError(String, String);

Example

[Visual Basic, C#, C++] The following example sets an error description for a specified DataRow.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of SetColumnError. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Private Sub SetColError(ByVal myRow As DataRow, byVal ColIndex As Integer)
    Dim errorString As String 
    errorString = "Replace this text."
    ' Set the error for the specified column of the row.
    myRow.SetColumnError(ColIndex, errorString)
 End Sub
 
 Private Sub PrintColError(ByVal myRow As DataRow, byVal ColIndex As Integer)
    ' Print the error of a specified column.
    Console.WriteLine(myRow.GetColumnError(ColIndex))
 End Sub

[C#] 
private void SetColError(DataRow myRow, int ColIndex){
    string errorString;
    errorString = "Replace this text.";
    // Set the error for the specified column of the row.
    myRow.SetColumnError(ColIndex, errorString);
 }
 
 private void PrintColError(DataRow myRow, int ColIndex){
    // Print the error of a specified column.
    Console.WriteLine(myRow.GetColumnError(ColIndex));
 }

[C++] 
private:
void SetColError(DataRow* myRow, int ColIndex){
    String* errorString;
    errorString = S"Replace this text.";
    // Set the error for the specified column of the row.
    myRow->SetColumnError(ColIndex, errorString);
 }
 
 void PrintColError(DataRow* myRow, int ColIndex){
    // Print the error of a specified column.
    Console::WriteLine(myRow->GetColumnError(ColIndex));
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

DataRow Class | DataRow Members | System.Data Namespace

Show:
© 2014 Microsoft