OleDbErrorCollection.Item[Int32] 属性

定义

获取位于指定索引处的错误。

public:
 property System::Data::OleDb::OleDbError ^ default[int] { System::Data::OleDb::OleDbError ^ get(int index); };
public System.Data.OleDb.OleDbError this[int index] { get; }
member this.Item(int) : System.Data.OleDb.OleDbError
Default Public ReadOnly Property Item(index As Integer) As OleDbError

参数

index
Int32

要检索的错误的从零开始的索引。

属性值

包含在指定索引位置的错误的 OleDbError

注解

以下示例显示 OleDbError 集合中的每个 OleDbErrorCollection

public void DisplayOleDbErrorCollection(OleDbException myException)   
  {  
     for (int i=0; i < myException.Errors.Count; i++)  
     {  
        MessageBox.Show("Index #" + i + "\n" +  
               "Message: " + myException.Errors[i].Message + "\n" +  
               "Native: " + myException.Errors[i].NativeError.ToString() + "\n" +  
               "Source: " + myException.Errors[i].Source + "\n" +  
               "SQL: " + myException.Errors[i].SQLState + "\n");  
     }  
  }  

适用于

另请参阅