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");  
     }  
  }  

適用於

另請參閱