次の方法で共有


DataRow.GetColumnError メソッド

列のエラーの説明を取得します。

オーバーロードの一覧

指定した DataColumn のエラーの説明を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetColumnError(DataColumn) As String

[C#] public string GetColumnError(DataColumn);

[C++] public: String* GetColumnError(DataColumn*);

[JScript] public function GetColumnError(DataColumn) : String;

インデックスで指定した列のエラーの説明を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetColumnError(Integer) As String

[C#] public string GetColumnError(int);

[C++] public: String* GetColumnError(int);

[JScript] public function GetColumnError(int) : String;

名前で指定した列のエラーの説明を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetColumnError(String) As String

[C#] public string GetColumnError(string);

[C++] public: String* GetColumnError(String*);

[JScript] public function GetColumnError(String) : String;

使用例

[Visual Basic, C#, C++] 指定した DataRow にエラーの説明を設定する例を次に示します。

[Visual Basic, C#, C++] メモ   ここでは、GetColumnError のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

参照

DataRow クラス | DataRow メンバ | System.Data 名前空間