名前で指定した列のエラーの説明を取得します。
Overloads Public Function GetColumnError( _
ByVal columnName As String _) As String
[C#]
public string GetColumnError(stringcolumnName);
[C++]
public: String* GetColumnError(String* columnName);
[JScript]
public function GetColumnError(
columnName : String) : String;
パラメータ
- columnName
列の名前。
戻り値
エラーの説明のテキスト。
解説
SetColumnError メソッドを使用して、列エラーを設定します。
列コレクションにエラーがあるかどうかを判断するには、 HasErrors メソッドを使用します。このため、 GetColumnsInError メソッドを使用して、エラーがあるすべての列を取得できます。
列コレクションのすべてのエラーをクリアするには、 ClearErrors メソッドを使用します。
使用例
[Visual Basic, C#, C++] 指定した DataRow にエラーの説明を設定する例を次に示します。
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++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
DataRow クラス | DataRow メンバ | System.Data 名前空間 | DataRow.GetColumnError オーバーロードの一覧 | ClearErrors | DataColumnCollection | Contains | DataColumn | GetColumnsInError | HasErrors | RowError | SetColumnError