OleDbErrorCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
收集 .NET Framework Data Provider for OLE DB 所產生的所有錯誤。 此類別無法獲得繼承。
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 IEnumerable
Public 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 類別的實例。
屬性
| 名稱 | Description |
|---|---|
| Count |
取得集合中的錯誤數量。 |
| Item[Int32] |
在指定的索引處產生錯誤。 |
方法
| 名稱 | Description |
|---|---|
| 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) |
明確介面實作
| 名稱 | Description |
|---|---|
| ICollection.IsSynchronized |
關於此成員的描述,請參見 IsSynchronized。 |
| ICollection.SyncRoot |
關於此成員的描述,請參見 SyncRoot。 |
擴充方法
| 名稱 | Description |
|---|---|
| AsParallel(IEnumerable) |
啟用查詢的平行處理。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別篩選 IEnumerable 的專案。 |