OleDbErrorCollection 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
收集 OLE DB .NET Framework 数据提供程序生成的所有错误。 此类不能被继承。
public ref class OleDbErrorCollection sealed : System::Collections::ICollection[System.ComponentModel.ListBindable(false)]
public sealed class OleDbErrorCollection : System.Collections.ICollection[System.ComponentModel.ListBindable(false)]
[System.Serializable]
public sealed class OleDbErrorCollection : System.Collections.ICollection[<System.ComponentModel.ListBindable(false)>]
type OleDbErrorCollection = class
    interface ICollection
    interface IEnumerable[<System.ComponentModel.ListBindable(false)>]
[<System.Serializable>]
type OleDbErrorCollection = class
    interface ICollection
    interface IEnumerablePublic NotInheritable Class OleDbErrorCollection
Implements ICollection- 继承
- 
				OleDbErrorCollection
- 属性
- 实现
示例
以下示例显示 OleDbError 集合中的每个 OleDbErrorCollection 。
public void DisplayOleDbErrorCollection(OleDbException exception)
{
   for (int i=0; i < exception.Errors.Count; i++)
   {
      MessageBox.Show("Index #" + i + "\n" +
             "Message: " + exception.Errors[i].Message + "\n" +
             "Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
             "Source: " + exception.Errors[i].Source + "\n" +
             "SQL: " + exception.Errors[i].SQLState + "\n");
   }
}
Public Sub DisplayOleDbErrorCollection(exception As OleDbException)
    Dim i As Integer
    For i = 0 To exception.Errors.Count - 1
        MessageBox.Show("Index #" + i.ToString() + ControlChars.Cr _
           + "Message: " + exception.Errors(i).Message + ControlChars.Cr _
           + "Native: " + exception.Errors(i).NativeError.ToString() + ControlChars.Cr _
           + "Source: " + exception.Errors(i).Source + ControlChars.Cr _
           + "SQL: " + exception.Errors(i).SQLState + ControlChars.Cr)
    Next i
End Sub
注解
此类由 创建 OleDbException ,用于收集类的 OleDbError 实例。 OleDbErrorCollection 始终至少包含类的 OleDbError 一个实例。
属性
| Count | 获取集合中错误的数目。 | 
| Item[Int32] | 获取位于指定索引处的错误。 | 
方法
| CopyTo(Array, Int32) | 将 OleDbErrorCollection 的元素复制到 Array 中,从 Array 中的指定索引处开始。 | 
| CopyTo(OleDbError[], Int32) | 将当前 OleDbErrorCollection 的所有元素复制到指定的 OleDbErrorCollection 中,并以指定的目标索引位置作为复制到的起始位置。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetEnumerator() | 公开 GetEnumerator() 方法,该方法支持 .NET Framework 数据提供程序对集合进行简单的迭代。 | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) | 
显式接口实现
| ICollection.IsSynchronized | 有关此成员的说明,请参见 IsSynchronized。 | 
| ICollection.SyncRoot | 有关此成员的说明,请参见 SyncRoot。 | 
扩展方法
| Cast<TResult>(IEnumerable) | 将 IEnumerable 的元素强制转换为指定的类型。 | 
| OfType<TResult>(IEnumerable) | 根据指定类型筛选 IEnumerable 的元素。 | 
| AsParallel(IEnumerable) | 启用查询的并行化。 | 
| AsQueryable(IEnumerable) | 将 IEnumerable 转换为 IQueryable。 |