共用方式為


OdbcException.Errors 屬性

定義

取得一個或多個 OdbcError 物件的集合,提供由 .NET Framework Data Provider for ODBC 所產生之例外狀況的相關詳細資訊。

public:
 property System::Data::Odbc::OdbcErrorCollection ^ Errors { System::Data::Odbc::OdbcErrorCollection ^ get(); };
public System.Data.Odbc.OdbcErrorCollection Errors { get; }
member this.Errors : System.Data.Odbc.OdbcErrorCollection
Public ReadOnly Property Errors As OdbcErrorCollection

屬性值

OdbcError 類別的已收集執行個體。

範例

下列範例會顯示集合內的每 OdbcError 一個 OdbcErrorCollection

public void DisplayOdbcErrorCollection(OdbcException 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 DisplayOdbcErrorCollection(exception As OdbcException)
    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

備註

這個屬性是的 OdbcErrorCollection包裝函式。

適用於

另請參閱