DataRow.GetColumnError 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取列的错误说明。
重载
| 名称 | 说明 |
|---|---|
| GetColumnError(String) |
获取按名称指定的列的错误说明。 |
| GetColumnError(DataColumn) |
获取指定 DataColumn的错误说明。 |
| GetColumnError(Int32) |
获取索引指定的列的错误说明。 |
GetColumnError(String)
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
获取按名称指定的列的错误说明。
public:
System::String ^ GetColumnError(System::String ^ columnName);
public string GetColumnError(string columnName);
member this.GetColumnError : string -> string
Public Function GetColumnError (columnName As String) As String
参数
- columnName
- String
列的名称。
返回
错误说明的文本。
示例
以下示例为指定的 DataRow值设置错误说明。
private void SetColError(DataRow row, int columnIndex)
{
string errorString = "Replace this text.";
// Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString);
}
private void PrintColError(DataRow row, int columnIndex)
{
// Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
byVal columnIndex As Integer)
Dim errorString As String = "Replace this text."
' Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString)
End Sub
Private Sub PrintColError( _
ByVal row As DataRow, byVal columnIndex As Integer)
' Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex))
End Sub
注解
使用该方法 SetColumnError 设置列错误。
若要确定列集合是否存在任何错误,请使用 HasErrors 该方法。 因此,可以使用 GetColumnsInError 该方法检索所有出现错误的列。
若要清除列集合的所有错误,请使用 ClearErrors 该方法。
另请参阅
- ClearErrors()
- DataColumnCollection
- Contains(String)
- DataColumn
- GetColumnsInError()
- HasErrors
- RowError
- SetColumnError(Int32, String)
适用于
GetColumnError(DataColumn)
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
获取指定 DataColumn的错误说明。
public:
System::String ^ GetColumnError(System::Data::DataColumn ^ column);
public string GetColumnError(System.Data.DataColumn column);
member this.GetColumnError : System.Data.DataColumn -> string
Public Function GetColumnError (column As DataColumn) As String
参数
- column
- DataColumn
返回
错误说明的文本。
示例
以下示例为指定的 DataRow值设置错误说明。
private void SetColError(DataRow row, int columnIndex)
{
string errorString = "Replace this text.";
// Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString);
}
private void PrintColError(DataRow row, int columnIndex)
{
// Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
byVal columnIndex As Integer)
Dim errorString As String = "Replace this text."
' Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString)
End Sub
Private Sub PrintColError( _
ByVal row As DataRow, byVal columnIndex As Integer)
' Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex))
End Sub
注解
使用该方法 SetColumnError 设置列错误。
若要确定列集合是否存在任何错误,请使用 HasErrors 该方法。 因此,可以使用 GetColumnsInError 该方法检索所有出现错误的列。 或者, GetErrors 该方法 DataTable 返回所有出现错误的行。
若要清除列集合的所有错误,请使用 ClearErrors 该方法。
另请参阅
- ClearErrors()
- DataColumnCollection
- Contains(String)
- DataColumn
- GetColumnsInError()
- GetErrors()
- HasErrors
- RowError
- SetColumnError(Int32, String)
适用于
GetColumnError(Int32)
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
获取索引指定的列的错误说明。
public:
System::String ^ GetColumnError(int columnIndex);
public string GetColumnError(int columnIndex);
member this.GetColumnError : int -> string
Public Function GetColumnError (columnIndex As Integer) As String
参数
- columnIndex
- Int32
列的从零开始的索引。
返回
错误说明的文本。
例外
参数 columnIndex 的范围不足。
示例
以下示例为指定的 DataRow值设置错误说明。
private void SetColError(DataRow row, int columnIndex)
{
string errorString = "Replace this text.";
// Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString);
}
private void PrintColError(DataRow row, int columnIndex)
{
// Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex));
}
Private Sub SetColError(ByVal row As DataRow, _
byVal columnIndex As Integer)
Dim errorString As String = "Replace this text."
' Set the error for the specified column of the row.
row.SetColumnError(columnIndex, errorString)
End Sub
Private Sub PrintColError( _
ByVal row As DataRow, byVal columnIndex As Integer)
' Print the error of a specified column.
Console.WriteLine(row.GetColumnError(columnIndex))
End Sub
注解
使用该方法 SetColumnError 设置列错误。
若要确定列集合是否存在任何错误,请使用 HasErrors 该方法。 因此,可以使用 GetColumnsInError 该方法检索所有出现错误的列。
若要清除列集合的所有错误,请使用 ClearErrors 该方法。
另请参阅
- ClearErrors()
- DataColumnCollection
- Contains(String)
- DataColumn
- GetColumnsInError()
- HasErrors
- RowError
- SetColumnError(Int32, String)